Add Gulp Plugins

Install Gulp SASS Plugin
- In command prompt, type 'npm install gulp-sass --save-dev'

Install Gulp Browser Sync Plugin
- In command prompt, type 'npm install -g browser-sync' or 'npm install browser-sync gulp --save-dev'

Add JS code of these plugin in 'gulpfile.js' which you have created manually.
var gulp        = require('gulp');
var browserSync = require('browser-sync').create();
var sass        = require('gulp-sass');

// Static Server + watching scss/html files
gulp.task('serve', ['sass'], function() {

        server: "./app"
    });"app/scss/*.scss", ['sass']);"app/js/*.js").on('change', browserSync.reload);"app/*.html").on('change', browserSync.reload);

// Compile sass into CSS & auto-inject into browsers
gulp.task('sass', function() {
    return gulp.src("app/scss/*.scss")
        .pipe(sass().on('error', function(err) {
            browserSync.notify(err.message, 3000); // Display error in the browser
            this.emit('end'); // Prevent gulp from catching the error and exiting the watch process

gulp.task('default', ['serve']); 

For more plugins, go to:

Share this

Related Posts