-
-
Save minhchu/1f4d2f50f4207db83411d5b3c3e50f2e 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
1. copy above files to your local folder | |
2. run `npm install` | |
3. run `npm -g gulp` | |
4. run `gulp sass` | |
5. run `gulp browser-sync` |
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 sass = require('gulp-sass'); | |
var concat = require('gulp-concat'); | |
var browserSync = require('browser-sync').create(); | |
var config = { | |
sassFolder: 'scss/*.scss', | |
compiledCssFile: 'app.css', | |
cssFolder: 'css/' | |
} | |
gulp.task('sass', function() { | |
return gulp.src(config.sassFolder) | |
.pipe(sass().on('error', function(err) { | |
console.log(err.toString()); | |
this.emit('end'); | |
})) | |
.pipe(concat(config.compiledCssFile)) | |
.pipe(gulp.dest(config.cssFolder)); | |
}); | |
gulp.task('browser-sync', function() { | |
browserSync.init({ | |
server: { | |
baseDir: './' | |
} | |
}); | |
}); |
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": "demo", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"author": "", | |
"license": "ISC", | |
"devDependencies": { | |
"browser-sync": "^2.16.0", | |
"gulp": "^3.9.1", | |
"gulp-concat": "^2.6.0", | |
"gulp-sass": "^2.3.2" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment