Skip to content

Commit

Permalink
Added module requirement support for npm and browserify
Browse files Browse the repository at this point in the history
  • Loading branch information
BarakChamo committed May 29, 2015
1 parent df57c66 commit fc9b37d
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 15 deletions.
2 changes: 1 addition & 1 deletion dist/directive.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*!
* ng-promise-status
*
* Version: 0.1.1 - 2015-05-06T15:36:52.550Z
* Version: 0.1.2 - 2015-05-29T17:06:50.060Z
* License: MIT
*/

Expand Down
6 changes: 4 additions & 2 deletions dist/directive.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/*!
* ng-promise-status
*
* Version: 0.1.1 - 2015-05-07T10:40:47.345Z
* Version: 0.1.2 - 2015-05-29T17:06:50.052Z
* License: MIT
*/


(function (angular) {
'use strict';

angular.module('ngPromiseStatus', [])
Expand Down Expand Up @@ -252,4 +253,5 @@ angular.module('ngPromiseStatus', [])
};
}])
;
angular.module("ngPromiseStatus").run(["$templateCache", function($templateCache) {$templateCache.put("directive.html","<button class=\"status-button\" ng-click=\"; statusButtonClick($event)\" ng-class=\"$class\" ng-disabled=\"$config.progress_disable && $status === \'inprogress\'\"></button>");}]);
angular.module("ngPromiseStatus").run(["$templateCache", function($templateCache) {$templateCache.put("directive.html","<button class=\"status-button\" ng-click=\"; statusButtonClick($event)\" ng-class=\"$class\" ng-disabled=\"$config.progress_disable && $status === \'inprogress\'\"></button>");}]);
})((typeof exports !== 'undefined' || typeof module !== 'undefined' && module.exports) ? require('angular') : angular);
2 changes: 1 addition & 1 deletion dist/directive.min.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* ng-promise-status
*
* Version: 0.1.1 - 2015-05-06T15:36:52.550Z
* Version: 0.1.2 - 2015-05-29T17:06:50.060Z
* License: MIT
*/.the-directive{color:green}.the-directive button{padding:10px;color:#00f}
4 changes: 2 additions & 2 deletions dist/directive.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 13 additions & 8 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global require */
/* global require, __dirname */
"use strict";

var fs = require('fs');
Expand All @@ -20,6 +20,7 @@ var plumber = require('gulp-plumber');
var open = require('gulp-open');
var less = require('gulp-less');
var order = require("gulp-order");
var wrapper = require("gulp-wrapper");


var config = {
Expand Down Expand Up @@ -65,7 +66,7 @@ gulp.task('scripts', function() {
quotes: true
}))
.pipe(templateCache({module: 'ngPromiseStatus'}));
};
}

function buildDistJS(){
return gulp.src('src/directive.js')
Expand All @@ -75,7 +76,7 @@ gulp.task('scripts', function() {
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'));
};
}

es.merge(buildDistJS(), buildTemplates())
.pipe(plumber({
Expand All @@ -86,10 +87,14 @@ gulp.task('scripts', function() {
'template.js'
]))
.pipe(concat('directive.js'))
.pipe(wrapper({
header: '(function (angular) {\n',
footer: "\n})((typeof exports !== 'undefined' || typeof module !== 'undefined' && module.exports) ? require('angular') : angular);\n"
}))
.pipe(header(config.banner, {
timestamp: (new Date()).toISOString(), pkg: config.pkg
}))
.pipe(gulp.dest('dist'))
.pipe(gulp.dest('./dist'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify({preserveComments: 'some'}))
.pipe(gulp.dest('./dist'))
Expand All @@ -104,10 +109,10 @@ gulp.task('styles', function() {
.pipe(header(config.banner, {
timestamp: (new Date()).toISOString(), pkg: config.pkg
}))
.pipe(gulp.dest('dist'))
.pipe(gulp.dest('./dist'))
.pipe(minifyCSS())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('dist'))
.pipe(gulp.dest('./dist'))
.pipe(connect.reload());
});

Expand All @@ -118,7 +123,7 @@ gulp.task('open', function(){

gulp.task('jshint-test', function(){
return gulp.src('./test/**/*.js').pipe(jshint());
})
});

gulp.task('karma', function (done) {
karma.start({
Expand All @@ -136,7 +141,7 @@ gulp.task('karma-serve', function(done){
function handleError(err) {
console.log(err.toString());
this.emit('end');
};
}

gulp.task('build', ['clean', 'scripts', 'styles']);
gulp.task('serve', ['build', 'connect', 'watch', 'open']);
Expand Down
10 changes: 9 additions & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ module.exports = function(config) {
basePath: '',

// Frameworks to use
frameworks: ['jasmine'],
frameworks: ['jasmine', 'commonjs'],

preprocessors: {
'**/*.js': ['commonjs']
},

commonjsPreprocessor: {
modulesRoot: 'dist'
},

// List of files / patterns to load in the browser
files: [
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@
"gulp-rename": "^1.2.0",
"gulp-uglify": "^1.0.1",
"gulp-util": "^3.0.1",
"gulp-wrapper": "^1.0.0",
"jshint-stylish": "^1.0.0",
"karma": "^0.12.24",
"karma-chrome-launcher": "^0.1.5",
"karma-commonjs": "0.0.13",
"karma-firefox-launcher": "^0.1.3",
"karma-jasmine": "^0.1.5",
"mversion": "^1.6.0"
Expand Down

0 comments on commit fc9b37d

Please sign in to comment.