Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
cognitom committed Oct 1, 2014
0 parents commit 2b97c6a
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 0 deletions.
22 changes: 22 additions & 0 deletions bower.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
gulp = require 'gulp'
rename = require 'gulp-rename'
bower = require 'bower'
runSequence = require 'run-sequence'
merge = require 'merge-stream'
meta = require './package.json'

$ = meta.gulpvar

gulp.task 'bower', (cb) -> runSequence 'bower-update', 'bower-copy', cb

gulp.task 'bower-install', -> bower.commands.install()

gulp.task 'bower-update', -> bower.commands.update()

gulp.task 'bower-copy', ->
bowerSrc =
for key, val of $.bowerMap
gulp.src "./bower_components/#{val}"
.pipe rename basename: key
merge bowerSrc
.pipe gulp.dest "#{$.bowerDist}/"
17 changes: 17 additions & 0 deletions coffee.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
gulp = require 'gulp'
browserify = require 'browserify'
source = require 'vinyl-source-stream'
streamify = require 'gulp-streamify'
uglify = require 'gulp-uglify'
meta = require './package.json'

$ = meta.gulpvar

gulp.task 'coffee', ->
browserify
entries: ["#{$.coffeeSrc}/index.coffee"]
extensions: ['.coffee']
.bundle()
.pipe source 'index.js'
.pipe streamify uglify mangle: false# without mangling for AngularJS
.pipe gulp.dest "#{$.coffeeDist}/"
22 changes: 22 additions & 0 deletions css.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
gulp = require 'gulp'
cssimport = require 'gulp-cssimport'
autoprefixer = require 'gulp-autoprefixer'
minifyCss = require 'gulp-minify-css'
csslint = require 'gulp-csslint'
notify = require 'gulp-notify'
meta = require './package.json'

$ = meta.gulpvar

gulp.task 'css', ->
gulp.src ["#{$.cssSrc}/style.css"]
.pipe cssimport()
.pipe autoprefixer 'last 2 versions'
.pipe minifyCss keepSpecialComments: 0
.pipe gulp.dest "#{$.cssDist}/"

gulp.task 'css-lint', ->
gulp.src ["#{$.cssSrc}/**/*.css"]
.pipe csslint()
.pipe csslint.reporter()
.pipe notify (file) -> "#{file.relative} (#{file.csslint.results.length} errors)" unless file.csslint.success
23 changes: 23 additions & 0 deletions gulpfile.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
gulp = require 'gulp'
runSequence = require 'run-sequence'
requireDir = require 'require-dir'
dir = requireDir './task'
del = require 'del'
browserSync = require 'browser-sync'
reload = browserSync.reload
meta = require './package.json'

$ = meta.gulpvar

gulp.task 'default', (cb) -> runSequence 'clean', ['coffee'], cb

gulp.task 'clean', (cb) -> del [$.dist], -> cb()

gulp.task 'watch', ->
browserSync.init
notify: false
server: baseDir: "#{$.dist}/"
o = debounceDelay: 3000
gulp.watch ["#{$.coffeeDist}/**/*.coffee"], o, ['coffee']
gulp.watch ["#{$.cssDist}/**/*.css"], o, ['css']
gulp.watch ["#{$.dist}/**/*.css", "#{$.dist}/**/*.html"], o, reload
12 changes: 12 additions & 0 deletions html.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
gulp = require 'gulp'
changed = require 'gulp-changed'
replace = require 'gulp-replace'
meta = require './package.json'

$ = meta.gulpvar

gulp.task 'html', ->
gulp.src ["#{$.htmlSrc}/*.html"]
.pipe changed "#{$.htmlDist}/"
.pipe replace ".#{$.htmlDist}/js/", 'js/'
.pipe gulp.dest "#{$.htmlDist}/"
24 changes: 24 additions & 0 deletions icon.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
gulp = require 'gulp'
rename = require 'gulp-rename'
sketch = require 'gulp-sketch'
iconfont = require 'gulp-iconfont'
consolidate = require 'gulp-consolidate'
meta = require './package.json'

$ = meta.gulpvar

gulp.task 'icon', ->
gulp.src "#{$.iconSrc}/#{$.iconName}.sketch}"
.pipe sketch
export: 'artboards'
formats: 'svg'
.pipe iconfont fontName: $.iconName
.on 'codepoints', (codepoints) ->
gulp.src "#{$.iconSrc}/#{$.iconTemplate}.*"
.pipe consolidate 'lodash',
glyphs: codepoints
fontName: $.iconName
className: $.iconClass
.pipe rename basename: $.iconName
.pipe gulp.dest "#{$.iconDist}/"
.pipe gulp.dest "#{$.iconDist}/"
28 changes: 28 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "gulpfile",
"description": "gulpfile for gulp.js",
"author": "Tsutomu Kawamura <[email protected]>",
"license": "MIT",
"private": true,
"gulpvar": {
"src": "./src",
"dist": "./dist",
"bowerDist": "./dist/js",
"bowerMap": {
"parse": "parse/index.js",
"angular": "angular/angular.min.js"
},
"coffeeDist": "./dist/coffee",
"coffeeSrc": "./src/coffee",
"cssDist": "./dist/css",
"cssSrc": "./src/css",
"htmlDist": "./dist",
"htmlSrc": "./src",
"iconClass": "mi",
"iconDist": "./dist/font",
"iconSrc": "./src/icon",
"iconTemplate": "fontawesome-style",
"parseDist": "./cloud",
"parseSrc": "./src/parse"
}
}
12 changes: 12 additions & 0 deletions parse.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
gulp = require 'gulp'
coffee = require 'gulp-coffee'
changed = require 'gulp-changed'
meta = require './package.json'

$ = meta.gulpvar

gulp.task 'parse', ->
gulp.src ["#{$.parseSrc}/**/*.coffee"]
.pipe changed "#{$.parseDist}/"
.pipe coffee bare: true
.pipe gulp.dest "#{$.parseDist}/"

0 comments on commit 2b97c6a

Please sign in to comment.