Skip to content

Instantly share code, notes, and snippets.

@zakdances
Created March 13, 2013 23:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zakdances/af5b7feacfde32f5c063 to your computer and use it in GitHub Desktop.
Save zakdances/af5b7feacfde32f5c063 to your computer and use it in GitHub Desktop.
Gruntfile
Grunt filemodule.exports = (grunt) ->
sassFiles = {}
cssFiles = {}
jsFields = {}
publicPath = "myproject/public/"
cssPath = publicPath + "css/"
jsPath = publicPath + "js/"
jsPagesPath = jsPath + "pages/"
jsCompiledPath = jsPath + "compiled/"
jsTempPath = jsPath + 'temp/'
submodulePath = publicPath + "submodules/"
componentsPath = publicPath + "components/"
# makeCSSPaths = function()
sassFiles[cssPath + "compiled/messy/dp_build.css"] = cssPath + "dp_build.scss"
sassFiles[cssPath + "compiled/messy/dp_index.css"] = cssPath + "dp_index.scss"
sassFiles[cssPath + "compiled/messy/dp_home.css"] = cssPath + "dp_home.scss"
sassFiles[cssPath + "compiled/messy/dp_browse.css"] = cssPath + "dp_browse.scss"
sassFiles[cssPath + "compiled/messy/dp_top.css"] = cssPath + "dp_top.scss"
sassFiles[cssPath + "compiled/messy/dp_video.css"] = cssPath + "dp_video.scss"
cssFiles[cssPath + "compiled/dp_build.css"] = cssPath + "compiled/messy/dp_build.css"
cssFiles[cssPath + "compiled/dp_index.css"] = cssPath + "compiled/messy/dp_index.css"
cssFiles[cssPath + "compiled/dp_home.css"] = cssPath + "compiled/messy/dp_home.css"
cssFiles[cssPath + "compiled/dp_browse.css"] = cssPath + "compiled/messy/dp_browse.css"
cssFiles[cssPath + "compiled/dp_top.css"] = cssPath + "compiled/messy/dp_top.css"
cssFiles[cssPath + "compiled/dp_video.css"] = cssPath + "compiled/messy/dp_video.css"
# lineNumbers
# debugInfo
jsFields[jsCompiledPath] = jsPath + "*.coffee"
tempCoffee = jsTempPath + "temp.coffee"
jsBuildFile = jsCompiledPath + "dp_build.js"
coffeeCompile = {}
coffeeCompile[jsBuildFile] = tempCoffee
extraSubmoduleCoffee = ['zGrowl/zGrowl.coffee']
extraComponentsJS = ['jquery-form/jquery.form.js','jquery-hoverIntent/jquery.hoverIntent.js','Pause/jquery.pause.min.js','jquery-cookie/jquery.cookie.js','jQuery-URL-Parser/purl.js']
extraSubmoduleJS = ['bl-jquery-image-center/js/jquery.blImageCenter.js']
moreJS = ['compiled/jquery-ui-1.10.0.custom/js/jquery-ui-1.10.0.custom.min.js']
extraSubmoduleCoffee = (submodulePath + cof for cof in extraSubmoduleCoffee)
extraComponentsJS = (componentsPath + js for js in extraComponentsJS)
extraSubmoduleJS = (submodulePath + js for js in extraSubmoduleJS)
moreJS = (jsPath + js for js in moreJS)
# extraJS = extraComponentsJS.concat extraSubmoduleJS,moreJS
# extraJS.unshift jsBuildFile
configOptions =
pkg: grunt.file.readJSON("package.json")
sass:
dev:
files: sassFiles
cssmin:
compress:
files: cssFiles
options: "keep-line-breaks"
concat:
options:
separator: ";"
dev1:
src: [jsPath + "*.coffee"].concat(extraSubmoduleCoffee)
dest: tempCoffee
dev2:
src: [jsBuildFile].concat(extraComponentsJS,extraSubmoduleJS,moreJS)
dest: jsBuildFile
coffee:
compile:
files: coffeeCompile
glob_to_multiple:
expand: true
cwd: jsPagesPath
src: ["*.coffee"]
dest: jsCompiledPath
ext: ".js"
clean:
dev: [jsTempPath]
grunt.initConfig configOptions
grunt.loadNpmTasks "grunt-contrib-sass"
grunt.loadNpmTasks "grunt-contrib-cssmin"
grunt.loadNpmTasks "grunt-contrib-concat"
grunt.loadNpmTasks "grunt-contrib-coffee"
grunt.loadNpmTasks "grunt-contrib-clean"
grunt.registerTask "default", ["sass", "cssmin", "concat:dev1", "coffee", "concat:dev2", 'clean']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment