Skip to content

Commit

Permalink
Rewrite in Coffeescript, updated gulp build
Browse files Browse the repository at this point in the history
Still need to add a build stage as for now nothing is being minified, but for development this should work fine for now.

All sourcemaps working.
Cleared out uncertain files.
Added a more robust .gitignore.
Removed Susy/Compass.
Added Bourbon/Neat.
  • Loading branch information
thesublimeobject committed Jan 25, 2015
1 parent c4f5745 commit 56e214e
Show file tree
Hide file tree
Showing 195 changed files with 513 additions and 65,109 deletions.
18 changes: 17 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
# As Yeoman assumes the usage of Bower and Grunt, ignore the below:
bower_components
node_modules

# Ignore automatically generated cruft
*.log
.sass-cache

# Ignore Test Files
index.html

# Operating system files
.Spotlight-V100
.Trashes
.DS_Store
.sass-cache
.DS_Store?
ehthumbs.db
Thumbs.db
4 changes: 1 addition & 3 deletions assets/bower.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{
"name": "thm",
"version": "1.0.0",
"dependencies": {
"underscore": "~1.6.0"
},
"dependencies": {},
"private": true
}
38 changes: 38 additions & 0 deletions assets/gulp/config.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
neat = require('node-neat').includePaths
dest = "../bld"
src = "./src"

module.exports =

browserSync:
proxy: "thm.dev/"
ghostMode:
clicks: false
location: false
forms: false
scroll: false

sass:
src: "styl/src/**"
dest: dest
settings:
sourceComments: 'map',
imagePath: '/img',
errLogToConsole: true,
includePaths: ['sass'].concat(neat)

markup:
src: ['../*.html', '../*.php', '../inc/*.php', '../templates/*.php']

images:
src: "/img/**"
dest: dest + "/img"

browserify:
bundleConfigs: [
entries: './js/src/app.coffee'
dest: dest
extensions: ['.coffee']
outputName: 'app.js'
debug: true
]
7 changes: 0 additions & 7 deletions assets/gulp/index.js

This file was deleted.

9 changes: 9 additions & 0 deletions assets/gulp/tasks/browserSync.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
browserSync = require 'browser-sync'
gulp = require 'gulp'
config = require('../config').browserSync

gulp.task 'browserSync', ->
browserSync(config)

gulp.task 'bs-reload', ->
browserSync.reload()
18 changes: 0 additions & 18 deletions assets/gulp/tasks/browserSync.js

This file was deleted.

55 changes: 55 additions & 0 deletions assets/gulp/tasks/browserify.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
browserify = require 'browserify'
browserSync = require 'browser-sync'
watchify = require 'watchify'
bundleLogger = require '../util/bundleLogger'
gulp = require 'gulp'
handleErrors = require '../util/handleErrors'
source = require 'vinyl-source-stream'
config = require('../config').browserify
_ = require 'lodash'

browserifyTask = (callback, devMode) ->

bundleQueue = config.bundleConfigs.length

browserifyThis = (bundleConfig) ->

if devMode
_.extend bundleConfig, watchify.args, debug: true
bundleConfig = _.omit bundleConfig, ['external', 'require']

b = browserify(bundleConfig)

bundle = ->
bundleLogger.start(bundleConfig.outputName)

return b
.bundle()
.on 'error', handleErrors
.pipe(source(bundleConfig.outputName))
.pipe(gulp.dest(bundleConfig.dest))
.on 'end', reportFinished
.pipe(browserSync.reload
stream: true
)

b = watchify(b)
b.on 'update', bundle
bundleLogger.watch(bundleConfig.outputName)

reportFinished = ->
bundleLogger.end(bundleConfig.outputName)

if bundleQueue
bundleQueue--
if bundleQueue is 0
callback()
return

return bundle()

config.bundleConfigs.forEach(browserifyThis)

gulp.task 'browserify', browserifyTask

module.exports = browserifyTask
52 changes: 0 additions & 52 deletions assets/gulp/tasks/browserify.js

This file was deleted.

3 changes: 0 additions & 3 deletions assets/gulp/tasks/build.js

This file was deleted.

3 changes: 3 additions & 0 deletions assets/gulp/tasks/default.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
gulp = require 'gulp'

gulp.task 'default', ['browserify', 'sass', 'images', 'watch']
3 changes: 0 additions & 3 deletions assets/gulp/tasks/default.js

This file was deleted.

14 changes: 14 additions & 0 deletions assets/gulp/tasks/images.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
changed = require 'gulp-changed'
gulp = require 'gulp'
imagemin = require 'gulp-imagemin'
config = require('../config').images
browserSync = require 'browser-sync'

gulp.task 'images', ->
return gulp.src(config.src)
.pipe(changed(config.dest))
.pipe(imagemin())
.pipe(gulp.dest(config.dest))
.pipe(browserSync.reload
stream: true
)
9 changes: 9 additions & 0 deletions assets/gulp/tasks/markup.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
gulp = require 'gulp'
config = require('../config').markup
browserSync = require 'browser-sync'

gulp.task 'markup', ->
return gulp.src(config.src)
.pipe(browserSync.reload
stream: true
)
25 changes: 25 additions & 0 deletions assets/gulp/tasks/sass.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
gulp = require('gulp')
browserSync = require('browser-sync')
sass = require('gulp-sass')
sourcemaps = require('gulp-sourcemaps')
handleErrors = require('../util/handleErrors')
config = require('../config').sass
autoprefixer = require('gulp-autoprefixer')
neat = require('node-neat').includePaths

gulp.task 'sass', ->
return gulp.src('styl/src/screen.scss')
.pipe(sourcemaps.init())
.pipe(sass
sourceComments: 'map'
imagePath: '/img'
errLogToConsole: true
includePaths: ['sass'].concat(neat)
)
.pipe(autoprefixer
browsers: ['last 2 version']
)
.pipe(sourcemaps.write())
.on('error', handleErrors)
.pipe(gulp.dest(config.dest))
.pipe(browserSync.reload({stream:true}))
4 changes: 4 additions & 0 deletions assets/gulp/tasks/setWatch.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
gulp = require 'gulp'

gulp.task 'setWatch', ->
global.isWatching = true
5 changes: 0 additions & 5 deletions assets/gulp/tasks/setWatch.js

This file was deleted.

27 changes: 0 additions & 27 deletions assets/gulp/tasks/styl.js

This file was deleted.

20 changes: 20 additions & 0 deletions assets/gulp/tasks/uglify.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
gulp = require 'gulp'
config = require('../config').browserify
size = require 'gulp-filesize'
uglify = require 'gulp-uglify'
rename = require 'gulp-rename'
browserSync = require 'browser-sync'

gulp.task 'uglify', ['browserify'], ->
return gulp.src('../bld/app.js')
.pipe(uglify())
.pipe(rename
suffix: '.min'
)
.pipe(gulp.dest('../bld'))
.pipe(size())
.pipe(browserSync.reload
stream: true
once: true
notify: false
)
15 changes: 0 additions & 15 deletions assets/gulp/tasks/uglify.js

This file was deleted.

10 changes: 10 additions & 0 deletions assets/gulp/tasks/watch.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
gulp = require 'gulp'
config = require '../config'
watchify = require './browserify'

gulp.task 'watch', ['setWatch','browserSync'], (callback) ->
gulp.watch('./js/src/*.coffee', ['browserify'])
# gulp.watch('../bld/app.js', ['uglify'])
gulp.watch(config.sass.src, ['sass'])
gulp.watch(config.images.src, ['images'])
gulp.watch(config.markup.src, ['bs-reload'])
13 changes: 0 additions & 13 deletions assets/gulp/tasks/watch.js

This file was deleted.

Loading

0 comments on commit 56e214e

Please sign in to comment.