Created
January 25, 2018 19:53
-
-
Save daigofuji/2e0f2271ae9cd49edd27c5310fe9ba35 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require('gulp'); | |
var $ = require('gulp-load-plugins')(); | |
var sassPaths = []; | |
gulp.task('sass', function() { | |
return gulp.src('scss/app.scss') | |
.pipe($.sourcemaps.init()) | |
.pipe($.sass({ | |
includePaths: sassPaths, | |
outputStyle: 'expanded' // compressed or use expanded for dev | |
}) | |
.on('error', $.sass.logError)) | |
.pipe($.autoprefixer({ | |
browsers: ['last 2 versions', 'ie >= 9'] | |
})) | |
.pipe($.sourcemaps.write('.')) | |
.pipe(gulp.dest('css')); | |
}); | |
gulp.task('minify-css', function() { | |
return gulp.src('css/app.css') | |
.pipe($.cleanCss()) | |
.pipe($.rename({suffix: '.min'})) | |
.pipe(gulp.dest('css')); | |
}); | |
gulp.task('default', ['sass'], function() { | |
gulp.watch(['scss/**/*.scss'], ['sass']); | |
}); | |
gulp.task('build', ['sass', 'minify-css'], function() { | |
console.log('Building minified css files'); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "", | |
"version": "1.0.0", | |
"description": "", | |
"main": "gulpfile.js", | |
"scripts": { | |
"start": "gulp", | |
"build": "gulp build" | |
}, | |
"repository": { | |
"type": "git", | |
"url": "" | |
}, | |
"author": "", | |
"license": "", | |
"bugs": { | |
"url": "" | |
}, | |
"homepage": "", | |
"devDependencies": { | |
"gulp": "^3.9.1", | |
"gulp-autoprefixer": "^4.1.0", | |
"gulp-load-plugins": "^1.5.0", | |
"gulp-sass": "^3.1.0", | |
"normalize.css": "^7.0.0", | |
"gulp-clean-css": "^3.9.2", | |
"gulp-rename": "^1.2.2", | |
"gulp-sourcemaps": "^2.6.3" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment