Created
September 19, 2016 12:02
-
-
Save Langmans/591bfc5f5b829d37bdc738779fd38396 to your computer and use it in GitHub Desktop.
gulp> scss > autoprefixer > css
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
/** | |
* To install: | |
* install npm | |
* cd public_html/files/stylesheets | |
* npm update | |
* | |
* to watch: | |
* gulp | |
* or to run sass once: | |
* gulp sass | |
*/ | |
var gulp = require('gulp'); | |
var sass = require('gulp-sass'); | |
var sourcemaps = require('gulp-sourcemaps'); | |
// auto adds vendor prefixed props | |
var autoprefixer = require('gulp-autoprefixer'); | |
var watch = require('gulp-watch'); | |
var input = './**.scss'; | |
var output = '.'; | |
var sassOptions = { | |
errLogToConsole: true, | |
outputStyle: 'expanded' | |
}; | |
// ... variables | |
var autoprefixerOptions = { | |
browsers: ['last 5 versions', '> 0.5%'], | |
// remove outdated props? | |
remove: false | |
}; | |
gulp.task('sass', function () { | |
return gulp | |
.src(input) | |
.pipe(sourcemaps.init()) | |
.pipe(sass(sassOptions).on('error', sass.logError)) | |
.pipe(sourcemaps.write()) | |
.pipe(autoprefixer(autoprefixerOptions)) | |
.pipe(gulp.dest(output)); | |
}); | |
gulp.task('default', function () { | |
console.log('watching for scss file changes...'); | |
gulp.watch(input, ['sass']); | |
}); |
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": "stylesheets", | |
"version": "1.0.0", | |
"description": "", | |
"main": "Gulpfile.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"gulp": "^3.9.1", | |
"gulp-autoprefixer": "^3.1.1", | |
"gulp-sass": "^2.3.2", | |
"gulp-sourcemaps": "^1.6.0", | |
"gulp-watch": "^4.3.9" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment