Created
November 20, 2013 13:07
-
-
Save Haraldson/7562873 to your computer and use it in GitHub Desktop.
grunt-contrib-require
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
Gruntfile.js | |
package.json | |
node_modules/ | |
www/ | |
assets/ | |
js/ | |
app/ | |
app.js | |
lib/ | |
main.js |
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
module.exports = function(grunt) | |
{ | |
grunt.initConfig( | |
{ | |
pkg: grunt.file.readJSON('package.json'), | |
watch: { | |
css: { | |
files: ['www/assets/css/sass/**/*.scss'], | |
tasks: ['sass', 'autoprefixer', 'imageEmbed'] | |
} | |
}, | |
sass: { | |
dist: { | |
files: { | |
'www/assets/css/admin-interface.css': 'www/assets/css/sass/admin-interface.scss' | |
} | |
} | |
}, | |
autoprefixer: { | |
dist: { | |
files: { | |
'www/assets/css/admin-interface.css': 'www/assets/css/admin-interface.css' | |
} | |
} | |
}, | |
imageEmbed: { | |
dist: { | |
src: ['www/assets/css/admin-interface.css'], | |
dest: 'www/assets/css/admin-interface.css', | |
options: { | |
baseDir: 'www', | |
deleteAfterEncoding: false | |
} | |
} | |
}, | |
requirejs: { | |
options: { | |
baseUrl: 'www/assets/js/lib/', | |
mainConfigFile: 'www/assets/js/main.js', | |
include: ['app'], | |
keepBuildDir: true | |
}, | |
dev: { | |
options: { | |
out: 'www/assets/js/dev.js' | |
} | |
}, | |
prod: { | |
options: { | |
out: 'www/assets/js/prod.js' | |
} | |
} | |
}, | |
retire: { | |
files: ['www/assets/js/lib/*.js'] | |
} | |
}); | |
grunt.loadNpmTasks('grunt-contrib-watch'); | |
grunt.loadNpmTasks('grunt-sass'); | |
grunt.loadNpmTasks('grunt-autoprefixer'); | |
grunt.loadNpmTasks('grunt-image-embed'); | |
grunt.loadNpmTasks('grunt-contrib-requirejs'); | |
grunt.loadNpmTasks('grunt-retire'); | |
grunt.registerTask('default', ['watch']); | |
grunt.registerTask('build', ['requirejs', 'retire', 'sass', 'autoprefixer', 'imageEmbed']); | |
}; |
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
// Stripped config file, removed a lot of shims and app specific paths | |
requirejs.config( | |
{ | |
baseUrl: '/assets/js/lib/', | |
paths: { | |
'app': '../app[/...]', // Lots of lines like this... | |
'Handlebars': 'handlebars', | |
'domReady': 'require.domReady' | |
}, | |
shim: { | |
'Handlebars': { | |
exports: 'Handlebars' | |
}, | |
'hbs': { | |
deps: ['Handlebars', 'handlebars.helpers', 'i18nprecompile', 'json2'], | |
exports: 'Handlebars' | |
}, | |
'json2': { | |
exports: 'JSON' | |
}, | |
}, | |
hbs: { | |
disableI18n: true | |
} | |
}); | |
define(['app', 'domReady!'], function(App) | |
{ | |
App.start(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment