Created
April 29, 2015 11:51
-
-
Save Lotuashvili/31cbd853ae939210bcf9 to your computer and use it in GitHub Desktop.
Gulp System
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
autoprefixer = require 'gulp-autoprefixer' | |
coffee = require 'gulp-coffee' | |
gulp = require 'gulp' | |
gutil = require 'gulp-util' | |
ignore = require 'gulp-ignore' | |
minifycss = require 'gulp-minify-css' | |
notify = require 'gulp-notify' | |
plumber = require 'gulp-plumber' | |
rename = require 'gulp-rename' | |
stylus = require 'gulp-stylus' | |
uglify = require 'gulp-uglify' | |
cmq = require 'gulp-combine-media-queries' | |
isProduction = no | |
gulp.task 'build-production', -> | |
isProduction = yes | |
console.log 'Switching to Production' | |
gulp.start 'build' | |
# Stylus an CSS styles | |
gulp.task 'styles', -> | |
gulp.src 'resources/assets/stylus/**/*.styl' # Stylus | |
.pipe plumber | |
errorHandler: notify.onError 'Error: <%= error.message %>' | |
.pipe ignore.exclude '**/_*.styl' | |
.on 'error', gutil.log | |
.pipe stylus() | |
.pipe autoprefixer 'last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1' | |
.pipe rename | |
suffix: '.min' | |
.pipe cmq | |
log: yes | |
.pipe if isProduction | |
minifycss | |
processImport: yes | |
else | |
gutil.noop() | |
.pipe gulp.dest 'public/css' | |
gulp.src 'resources/assets/stylus/**/*.css' # Pre-compiler CSS | |
.pipe plumber | |
errorHandler: notify.onError 'Error: <%= error.message %>' | |
.pipe autoprefixer 'last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1' | |
.pipe rename | |
suffix: '.min' | |
.pipe minifycss | |
processImport: no | |
.pipe gulp.dest 'public/css' | |
# Front-end scripts | |
gulp.task 'scripts', -> | |
gulp.src 'resources/assets/coffee/**/*.coffee' | |
.pipe plumber | |
errorHandler: notify.onError 'Error: <%= error.message %>' | |
.pipe coffee | |
bare: no | |
.on 'error', gutil.log | |
.pipe if isProduction | |
uglify() | |
else | |
gutil.noop() | |
.pipe rename | |
suffix: '.min' | |
.pipe gulp.dest 'public/js' | |
# Watch task | |
gulp.task 'watch', -> | |
gulp.watch 'resources/assets/stylus/**/*', ['styles'] | |
gulp.watch 'resources/assets/coffee/**/*', ['scripts'] | |
return | |
### Other tasks ### | |
gulp.task 'build', ['scripts', 'styles'], -> | |
gulp.task 'default', ['watch', 'build'], -> |
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": "GulpFile", | |
"version": "1.0.0", | |
"author": "Levan Lotuashvili", | |
"description": "GulpFile", | |
"private": true, | |
"dependencies": { | |
"coffee-script": "latest" | |
}, | |
"devDependencies": { | |
"gulp": "^3.8.11", | |
"gulp-autoprefixer": "^2.1.0", | |
"gulp-chmod": "^1.2.0", | |
"gulp-coffee": "^2.3.1", | |
"gulp-combine-media-queries": "^0.2.0", | |
"gulp-ignore": "^1.2.1", | |
"gulp-insert": "^0.4.0", | |
"gulp-minify-css": "^0.5.0", | |
"gulp-notify": "^2.2.0", | |
"gulp-plumber": "^0.6.6", | |
"gulp-rename": "^1.2.0", | |
"gulp-stylus": "^2.0.1", | |
"gulp-uglify": "^1.1.0", | |
"gulp-util": "^3.0.4" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment