Created
March 4, 2016 21:11
-
-
Save nathanielks/3a5f272a494e0dafff9a to your computer and use it in GitHub Desktop.
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
// polyfill webpack require.ensure | |
if (typeof require.ensure !== 'function') require.ensure = (d, c) => c(require) | |
export default <% if (addStore) { %>(store) => (<% } %>{ | |
path: '<%= camelEntityName %>', | |
getComponents (location, cb) { | |
require.ensure([ | |
'views/<%= pascalEntityName %>View/<%= pascalEntityName %>View' | |
], (require) => { | |
let view = require('views/<%= pascalEntityName %>View/<%= pascalEntityName %>View').default | |
cb(null, view) | |
}) | |
} | |
}<% if (addStore) { %>)<% } %> |
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
const path = require('path') | |
module.exports = { | |
locals: function (options) { | |
var addStore = false | |
console.log(options.entity); | |
if (options.entity.options.addStore !== 'undefined') { | |
addStore = options.entity.options.addStore | |
} | |
// Return custom template variables here. | |
return { | |
addStore: addStore | |
} | |
}, | |
fileMapTokens: function (options) { | |
// Return custom tokens to be replaced in your files | |
return { | |
__token__: function (options) { | |
// logic to determine value goes here | |
return 'value' | |
} | |
} | |
}, | |
// Should probably never need to be overriden | |
filesPath: function () { | |
return path.join(this.path, 'files') | |
}, | |
beforeInstall: function (options) {}, | |
afterInstall: function (options) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment