diff --git a/.jshintrc b/.jshintrc index f607f32..4978fc8 100644 --- a/.jshintrc +++ b/.jshintrc @@ -11,7 +11,7 @@ "laxbreak": true, "laxcomma": true, "newcap": true, - "node": false, + "node": true, "shadow": false, "strict": true, "undef": true, diff --git a/.npmignore b/.npmignore index e1d944f..398125a 100644 --- a/.npmignore +++ b/.npmignore @@ -1,6 +1,7 @@ .* *.log bower.json +gulp gulpfile.js index.html test.js diff --git a/bower.json b/bower.json index 4ad0754..37ec50b 100644 --- a/bower.json +++ b/bower.json @@ -20,6 +20,7 @@ "ignore": [ "**/.*", "bower_components", + "gulp" "index.html", "node_modules", "test", diff --git a/dist/css/scheduler.css b/dist/css/scheduler.css new file mode 100644 index 0000000..0c85275 --- /dev/null +++ b/dist/css/scheduler.css @@ -0,0 +1,6 @@ +.scheduler { + color: #000; +} +.scheduler .something-inside-schedler { + background: #efefef; +} diff --git a/dist/css/scheduler.min.css b/dist/css/scheduler.min.css new file mode 100644 index 0000000..3bfdb28 --- /dev/null +++ b/dist/css/scheduler.min.css @@ -0,0 +1 @@ +.scheduler{color:#000;}.scheduler .something-inside-schedler{background:#efefef} \ No newline at end of file diff --git a/scheduler.js b/dist/js/scheduler.js similarity index 100% rename from scheduler.js rename to dist/js/scheduler.js diff --git a/dist/js/scheduler.min.js b/dist/js/scheduler.min.js new file mode 100644 index 0000000..b1cff8f --- /dev/null +++ b/dist/js/scheduler.min.js @@ -0,0 +1 @@ +!function(){"use strict"}(); \ No newline at end of file diff --git a/gulp/config.js b/gulp/config.js new file mode 100644 index 0000000..a3bf1a4 --- /dev/null +++ b/gulp/config.js @@ -0,0 +1,16 @@ +'use strict'; + +var config = {}; + +config.paths = { src: {}, dist: {} }; + +config.paths.src.base = './src/'; +config.paths.src.css = config.paths.src.base + 'css/'; +config.paths.src.js = config.paths.src.base + 'js/'; +config.paths.src.stylus = config.paths.src.base + 'stylus/'; + +config.paths.dist.base = './dist/'; +config.paths.dist.css = config.paths.dist.base + 'css/'; +config.paths.dist.js = config.paths.dist.base + 'js/'; + +module.exports = config; diff --git a/gulpfile.js b/gulpfile.js index c04b7a1..286e802 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,13 +1,79 @@ 'use strict'; -var gulp = require( 'gulp' ); -var jshint = require( 'gulp-jshint' ); +var gulp = require( 'gulp' ); +var jshint = require( 'gulp-jshint' ); +var rename = require( 'gulp-rename' ); +var runSequence = require( 'run-sequence' ); +var stylus = require( 'gulp-stylus' ); +var uglify = require( 'gulp-uglify' ); +// not sure if we'll use nib, but probably should add it +var nib = require( 'nib' ); -gulp.task('jshint', function() { - gulp.src( ['./scheduler.js', './test.js'] ) - .pipe( jshint('./.jshintrc') ) - .pipe( jshint.reporter( 'jshint-stylish' ) ); +var gulpConfig = require( './gulp/config' ); + +var paths = gulpConfig.paths; + +var stylusOptions = { + use: nib() + , compress: false +}; + +gulp.task( 'default', function( cb ) { + runSequence( 'jshint', 'release', cb ); }); -// will add tasks for min and other stuff +gulp.task( 'release', [ 'stylus', 'stylus:compress', 'uglify', 'copySrcFiles' ] ); + +gulp.task( 'watch', function() { + gulp.watch( paths.src.stylus + '**/*', [ 'stylus' ] ); +}); + +gulp.task( 'jshint', function() { + var files = [ + './gulpfile.js' + , './test.js' + , paths.src.js + 'scheduler.js' + ]; + + return gulp.src( files ) + .pipe( jshint( './.jshintrc' ) ) + .pipe( jshint.reporter( 'jshint-stylish' ) ) + .pipe( jshint.reporter( 'fail' ) ); +}); + +gulp.task( 'uglify', function() { + return gulp.src( [ paths.src.js + 'scheduler.js' ] ) + .pipe( uglify() ) + .pipe( rename({ + extname: '.min.js' + })) + .pipe( gulp.dest( paths.dist.js ) ); +}); + +gulp.task( 'stylus', function() { + stylusOptions.compress = false; + + return gulp.src( [ paths.src.stylus + 'scheduler.styl' ] ) + .pipe( stylus( stylusOptions ) ) + .pipe( gulp.dest( paths.src.css ) ); +}); + +gulp.task( 'stylus:compress', function() { + stylusOptions.compress = true; + + return gulp.src( [ paths.src.stylus + 'scheduler.styl' ] ) + .pipe( stylus( stylusOptions ) ) + .pipe( rename({ + extname: '.min.css' + })) + .pipe( gulp.dest( paths.dist.css ) ); +}); + +gulp.task( 'copySrcFiles', function() { + gulp.src( [ paths.src.js + '**/*' ] ) + .pipe( gulp.dest( paths.dist.js ) ); + + gulp.src( [ paths.src.css + '**/*' ] ) + .pipe( gulp.dest( paths.dist.css ) ); +}); diff --git a/package.json b/package.json index 308fd0a..cc39d41 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,11 @@ "devDependencies": { "gulp": "^3.8.10", "gulp-jshint": "^1.9.0", - "jshint-stylish": "^1.0.0" + "gulp-rename": "^1.2.0", + "gulp-stylus": "^1.3.4", + "gulp-uglify": "^1.0.2", + "jshint-stylish": "^1.0.0", + "nib": "^1.0.4", + "run-sequence": "^1.0.2" } } diff --git a/src/css/scheduler.css b/src/css/scheduler.css new file mode 100644 index 0000000..0c85275 --- /dev/null +++ b/src/css/scheduler.css @@ -0,0 +1,6 @@ +.scheduler { + color: #000; +} +.scheduler .something-inside-schedler { + background: #efefef; +} diff --git a/src/css/scheduler.min.css b/src/css/scheduler.min.css new file mode 100644 index 0000000..3bfdb28 --- /dev/null +++ b/src/css/scheduler.min.css @@ -0,0 +1 @@ +.scheduler{color:#000;}.scheduler .something-inside-schedler{background:#efefef} \ No newline at end of file diff --git a/src/js/scheduler.js b/src/js/scheduler.js new file mode 100644 index 0000000..00e022f --- /dev/null +++ b/src/js/scheduler.js @@ -0,0 +1,5 @@ +(function() { + 'use strict'; + + // we'll get there don't worry +})(); diff --git a/src/stylus/scheduler.styl b/src/stylus/scheduler.styl new file mode 100644 index 0000000..2675639 --- /dev/null +++ b/src/stylus/scheduler.styl @@ -0,0 +1,8 @@ +.scheduler { + // following is just testing + color: #000; + + .something-inside-schedler { + background: #efefef; + } +}