WordPress Hosting
Free Photos
WordPress Themes

Gulp task Browserify / Sass / Javascript

'use strict'; var browserify = require('browserify'); var gulp = require('gulp'); var uglify = require('gulp-uglify'); var jshint = require('gulp-jshint'); var source = require('vinyl-source-stream'); var buffer = require('vinyl-buffer'); var sass = require('gulp-sass'); var postcss = require('gulp-postcss'); var autoprefixer = require('autoprefixer'); var cssmin = require('gulp-cssmin'); var rename = require("gulp-rename"); var livereload = require('gulp-livereload'); var connect = require('gulp-connect'); gulp.task('jsLint', function () { gulp.src(['src/*.js']) .pipe(jshint()) .pipe(livereload()) }); gulp.task('js', function() { return browserify('src/[name].js') .bundle() .pipe(source('[name].min.js')) .pipe(buffer()) .pipe(uglify({ mangle: true })) .pipe(gulp.dest('dist/js')) .pipe(livereload()) }); gulp.task('sass', function(){ return gulp.src('src/[name].sass') .pipe(sass()) .pipe(postcss([ autoprefixer({ browsers: ['last 2 versions'] }) ])) .pipe(cssmin()) .pipe(rename({suffix: '.min'})) .pipe(gulp.dest('dist/css')) .pipe(livereload()) }); gulp.task('connect', function() { connect.server({ root: '[root-name]', port: 8888, livereload: true }); }); gulp.task('prod',['sass', 'js']); gulp.task('testjs',['jsLint', 'js']); gulp.task('watch', function(){ livereload.listen(); gulp.watch('src/*.sass', ['sass']) gulp.watch('src/*.js', ['js']) }); gulp.task('default', ['connect', 'watch']);

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.