diff --git a/.gitignore b/.gitignore index 6edd850..8774cec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /node_modules npm-debug.log +/dist \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index bc2b815..3cf608e 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -1,6 +1,8 @@ var gulp = require('gulp'), connect = require('gulp-connect'), - less = require('gulp-less'); + less = require('gulp-less'), + cleanCSS = require('gulp-clean-css'), + rename = require('gulp-rename'); gulp.task('webserver', function() { connect.server({ @@ -11,12 +13,21 @@ gulp.task('webserver', function() { gulp.task('less', function() { gulp.src('src/styles.less') .pipe(less()) + .pipe(cleanCSS({format: 'beautify'})) .pipe(gulp.dest('dist')) .pipe(connect.reload()); }); gulp.task('watch', function() { gulp.watch('src/*.less', ['less']); -}) +}); + +gulp.task('minify-css', () => { + gulp.src('dist/styles.css') + .pipe(cleanCSS()) + .pipe(rename('styles.min.css')) + .pipe(gulp.dest('dist')); +}); -gulp.task('default', ['less', 'webserver', 'watch']); \ No newline at end of file +gulp.task('default', ['less', 'webserver', 'watch']); +gulp.task('build', ['less', 'minify-css']) \ No newline at end of file diff --git a/package.json b/package.json index fbd8f8e..3ffbd16 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ "main": "index.js", "scripts": { "start": "node node_modules/gulp/bin/gulp.js", + "build": "node node_modules/gulp/bin/gulp.js build", "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { @@ -19,9 +20,11 @@ "homepage": "https://github.com/rhyneav/papercss#readme", "devDependencies": { "gulp": "3.9.1", + "gulp-clean-css": "^3.9.0", "gulp-connect": "5.0.0", "gulp-less": "3.3.2", "gulp-plumber": "1.1.0", + "gulp-rename": "^1.2.2", "gulp-watch-less": "1.0.1", "install": "0.10.1", "less": "2.7.2",