Last active
August 29, 2015 14:00
-
-
Save frederikchristensen/11356122 to your computer and use it in GitHub Desktop.
My current Gulp build. Check out the quick recipe for using CoffeeScript for your gulpfile here: https://github.com/gulpjs/gulp/blob/master/docs/recipes/using-coffee-script-for-gulpfile.md
This file contains hidden or 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
# Load plugins | |
gulp = require("gulp") | |
stylus = require("gulp-stylus") | |
minifycss = require("gulp-minify-css") | |
coffee = require("gulp-coffee") | |
uglify = require("gulp-uglify") | |
imagemin = require("gulp-imagemin") | |
rename = require("gulp-rename") | |
clean = require("gulp-clean") | |
concat = require("gulp-concat") | |
notify = require("gulp-notify") | |
cache = require("gulp-cache") | |
livereload = require("gulp-livereload") | |
lr = require("tiny-lr") | |
server = lr() | |
ftp = require("gulp-ftp") | |
# Styles | |
gulp.task "styles", -> | |
gulp.src("src/styles/main.styl") | |
.pipe(stylus(use: ["nib"])).pipe(gulp.dest("src/styles")) | |
.pipe(rename(suffix: ".min")) | |
.pipe(minifycss(keepSpecialComments: 1)) | |
.pipe(livereload(server)) | |
.pipe(gulp.dest("dist/styles")) | |
.pipe notify(message: "Styles task complete") | |
# CoffeeScript | |
gulp.task "coffee", -> | |
gulp.src("src/scripts/coffee/**/*") | |
.pipe(coffee(bare: true)) | |
.pipe gulp.dest("src/scripts/js") | |
# JavaScript + CoffeeScript | |
gulp.task "scripts", ["coffee"], -> | |
gulp.src("src/scripts/js/**/*") | |
.pipe(concat("app.js")) | |
.pipe(rename(suffix: ".min")) | |
.pipe(uglify()) | |
.pipe(livereload(server)) | |
.pipe(gulp.dest("dist/js")) | |
.pipe notify(message: "Scripts task complete") | |
# Images | |
gulp.task "images", -> | |
gulp.src("src/images/**/*").pipe(cache(imagemin( | |
optimizationLevel: 3 | |
progressive: true | |
interlaced: true | |
))) | |
.pipe(livereload(server)) | |
.pipe(gulp.dest("dist/images")) | |
.pipe notify(message: "Images task complete") | |
# Clean | |
gulp.task "clean", -> | |
gulp.src([ | |
"dist/styles" | |
"dist/js" | |
"dist/images" | |
], | |
read: false | |
).pipe clean() | |
# Default task | |
gulp.task "default", ["clean"], -> | |
gulp.start "styles", "scripts", "images" | |
# Deploy task | |
gulp.task "deploy", -> | |
gulp.src("dist/**/*").pipe(ftp( | |
host: "ftp.yourdomain.com" | |
remotePath: "remote/path" | |
user: "user" | |
pass: "path123" | |
)).pipe notify(message: "File deployed") | |
# Watch | |
gulp.task "watch", -> | |
server.listen 35729, (err) -> | |
return console.log(err) if err | |
gulp.watch "src/styles/**/*", ["styles"] | |
gulp.watch ["src/scripts/**/*"], ["scripts"] | |
gulp.watch "src/images/**/*", ["images"] |
This file contains hidden or 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
require('coffee-script/register') | |
require('./gulpfile.coffee') |
This file contains hidden or 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": "workflow-2014", | |
"version": "0.0.0", | |
"description": "Front-end Workflow 2014", | |
"main": "gulpfile.js", | |
"dependencies": { | |
"gulp": "^3.6.2", | |
"gulp-coffee": "~1.4.1", | |
"coffee-script": "^1.7.1", | |
"gulp-cache": "~0.1.1", | |
"gulp-clean": "~0.2.4", | |
"gulp-concat": "^2.2.0", | |
"gulp-imagemin": "~0.1.5", | |
"gulp-minify-css": "~0.3.0", | |
"gulp-notify": "^1.2.5", | |
"gulp-livereload": "^1.3.1", | |
"gulp-rename": "^1.2.0", | |
"gulp-uglify": "~0.2.1", | |
"tiny-lr": "~0.0.5", | |
"gulp-watch": "^0.6.2", | |
"gulp-stylus": "~0.0.12", | |
"gulp-util": "~2.2.14", | |
"gulp-ftp": "^0.2.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment