Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Implementation of Gulp
// Dependencies
'use strict';
var gulp = require('gulp');
var path = require('path');
var livereload = require('gulp-livereload');
var sass = require('gulp-sass');
var maps = require('gulp-sourcemaps');
var cleanCSS = require('gulp-clean-css');
var postcss = require('gulp-postcss');
var autoprefixer = require('autoprefixer');
var config = {
publicDir: './'
};
// SASS
gulp.task('sass', function () {
return gulp.src( path.join( config.publicDir, 'assets','scss','style.scss') )
.pipe(maps.init())
.pipe(sass().on('error', sass.logError))
.pipe(postcss([ autoprefixer() ]))
// .pipe(cleanCSS({debug: true}, (details) => {
// console.log(details.name + ': ' + details.stats.originalSize);
// console.log(details.name + ': ' + details.stats.minifiedSize);
// }))
.pipe(maps.write( './' ))
.pipe(gulp.dest('./'));
});
gulp.task('watch', function() {
livereload.listen();
gulp.watch('assets/scss/**/*.scss', ['sass']);
// gulp.watch('**/*.php', livereload.reload );
gulp.watch('style.css').on('change', livereload.changed);
});
gulp.task('default', function() {
console.log( "\nNew York Spine - Gulp Command List \n" );
console.log( "----------------------------\n" );
console.log( "gulp watch" );
console.log( "gulp sass" );
console.log( "gulp build \n" );
console.log( "----------------------------\n" );
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment