Skip to content

Instantly share code, notes, and snippets.

@nathanielks
Created March 4, 2016 21:11
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 nathanielks/3a5f272a494e0dafff9a to your computer and use it in GitHub Desktop.
Save nathanielks/3a5f272a494e0dafff9a to your computer and use it in GitHub Desktop.
// 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) { %>)<% } %>
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