Skip to content
This repository has been archived by the owner on Apr 24, 2019. It is now read-only.

Commit

Permalink
Automatically name page files by object key.
Browse files Browse the repository at this point in the history
This removes the `dest` key in the pages.json
and retrieves the filename automatically.

Unfortunately this adds another dependency as
we need to deep-extend the object but I think
this is worth it.

This is part of #131 and targets #123.
  • Loading branch information
anselmh committed Dec 3, 2014
1 parent 33656d4 commit bec8588
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions grunt/options/concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@
'use strict';

var xtend = require('xtend');
var deepExtend = require('deep-extend');
var pages = require('../../pages');
var config = require('../config');
var pageName;
var pagePath;

// Extend the pages object with the destination path of the page
for (pageName in pages) {
pagePath = 'temp/' + pageName + '.html';

deepExtend(pages[pageName], { 'dest': pagePath });
}

module.exports = xtend(pages, config.concat || {});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"requirejs": "2.1.15"
},
"devDependencies": {
"deep-extend": "^0.3.2",
"glob": "4.3.0",
"grunt": "0.4.5",
"grunt-contrib-clean": "0.6.0",
Expand Down
3 changes: 1 addition & 2 deletions pages.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"src/templates/index.html",
"src/modules/module/module.html",
"src/templates/footer.html"
],
"dest": "temp/index.html"
]
}
}

0 comments on commit bec8588

Please sign in to comment.