Skip to content

Instantly share code, notes, and snippets.

@geelen
Last active December 19, 2015 13:39
Show Gist options
  • Save geelen/5963874 to your computer and use it in GitHub Desktop.
Save geelen/5963874 to your computer and use it in GitHub Desktop.
npm install assemble --save-dev
diff --git a/examples/webapp/package.json b/examples/webapp/package.json
index efe2835..ac32dab 100644
--- a/examples/webapp/package.json
+++ b/examples/webapp/package.json
@@ -23,7 +23,8 @@
"grunt-svgmin": "~0.1.0",
"grunt-concurrent": "~0.1.0",
"matchdep": "~0.1.1",
- "connect-livereload": "~0.2.0"
+ "connect-livereload": "~0.2.0",
+ "assemble": "~0.4.1"
},
"engines": {
"node": ">=0.8.0"
diff --git a/examples/webapp/Gruntfile.js b/examples/webapp/Gruntfile.js
index 4ba1753..1b6e8ce 100644
--- a/examples/webapp/Gruntfile.js
+++ b/examples/webapp/Gruntfile.js
@@ -15,6 +15,7 @@ var mountFolder = function (connect, dir) {
module.exports = function (grunt) {
// load all grunt tasks
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
+ grunt.loadNpmTasks('assemble');
// configurable paths
var yeomanConfig = {
@@ -25,6 +26,10 @@ module.exports = function (grunt) {
grunt.initConfig({
yeoman: yeomanConfig,
watch: {
+ assemble: {
+ files: ['<%= yeoman.app %>/{,*/}*.hbs','<%= yeoman.app %>/{,*/}*.json'],
+ tasks: ['assemble:dist']
+ },
coffee: {
files: ['<%= yeoman.app %>/scripts/{,*/}*.coffee'],
tasks: ['coffee:dist']
@@ -42,7 +47,7 @@ module.exports = function (grunt) {
livereload: LIVERELOAD_PORT
},
files: [
- '<%= yeoman.app %>/*.html',
+ '{.tmp,<%= yeoman.app %>}/*.html',
'{.tmp,<%= yeoman.app %>}/styles/{,*/}*.css',
'{.tmp,<%= yeoman.app %>}/scripts/{,*/}*.js',
'<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
@@ -123,6 +128,19 @@ module.exports = function (grunt) {
}
}
},
+ assemble: {
+ options: {
+ data: '<%= yeoman.app %>/config.json'
+ },
+ dist: {
+ files: [{
+ expand: true,
+ cwd: '<%= yeoman.app %>',
+ src: '{,*/}*.hbs',
+ dest: '.tmp/'
+ }]
+ }
+ },
coffee: {
dist: {
files: [{
@@ -191,7 +209,7 @@ module.exports = function (grunt) {
options: {
dest: '<%= yeoman.dist %>'
},
- html: '<%= yeoman.app %>/index.html'
+ html: ['.tmp/*.html']
},
usemin: {
options: {
@@ -284,6 +302,7 @@ module.exports = function (grunt) {
concurrent: {
server: [
'compass',
+ 'assemble:dist',
'coffee:dist'
],
test: [
@@ -322,6 +341,7 @@ module.exports = function (grunt) {
grunt.registerTask('build', [
'clean:dist',
+ 'assemble:dist',
'useminPrepare',
'concurrent:dist',
'concat',
diff --git a/examples/webapp/app/index.html b/examples/webapp/app/index.hbs
similarity index 100%
rename from examples/webapp/app/index.html
rename to examples/webapp/app/index.hbs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment