grunt-assemble
grunt-assemble copied to clipboard
Stop Grunt template processing for a file
I have a markdown page with a fenced code block which contains Grunt's template syntax (<%=
)
bla-bla-bla
\```
test: {
options: {
urls: ['http://127.0.0.1:<%= connect.test.options.port %>/tests-runner.html']
}
}
\```
Building of this page fails somewhere inside Grunt. In grunt.config
actually. As it detects its template syntax and try to evaluate it.
It's template syntax but it's documentation not code.
All this happens before md processing and HB-helpers evaluating - I can see raw markdown content in debugger. Stacktrack: grunt.config processContext, assemle.js#613 build, assemle.js#556 assemble.js#397
Is it possible to avoid Grunt's template processing against file content?
@evil-shrike Thanks for the issue! If you're reporting a bug, please be sure to include:
- The version of
assemble
you are using. - Your assemblefile.js (This can be in a gist)
- The commandline output. (Screenshot or gist is fine)
- What you expected to happen instead.
grunt-assemble 0.5 Output:
Warning: An error occurred while processing a template (Cannot read property 'options' of undefined). Use --force to continue.
My Gruntfile is pretty big but basically it's something like this:
assemble: {
options: {
assets: config.dest + '/assets',
flatten: true,
layoutdir: 'templates/layouts',
data: 'data/metadata/*.{json,yml}',
partials: 'templates/partials/*.hbs',
helpers: 'templates/helpers/**/*.js',
config: '<%= config %>',
build: {
now: moment(now).format('DD.MM.YYYY'),
// it's for 'last-modified' HB-helper:
sources: {
docs: {
src: config.wcPath + '/Docs/articles/',
dest: '_stage/docs/'
},
caseStudy: {
src: config.csPath + '/Docs/',
dest: '_stage/casestudy/'
}
}
},
collections: [{
name: 'root',
sortby: 'order'
}, {
name: 'section'
}, {
name: 'pages'
}],
plugins: [
'plugins/lunr-indexer',
'plugins/page-toc'
],
lunr: {
dataPath: '<%= config.versionRoot %>/search_index.json',
indexPath: '<%= config.versionRoot %>/search_index_index.json',
baseDir: '<%= config.dest %>\\<%= config.versionDir %>'
},
toc: {
depth: 4,
autoInsert: true
}
},
casestudy: {
options: {
layout: 'casestudypage.hbs'
},
files: [{
expand: true,
cwd: '_stage',
src: ['casestudy/*.md'],
dots: true,
dest: config.versionRoot + '/',
ext: '.html'
}, {
expand: true,
cwd: 'templates/pages',
src: ['casestudy/*.hbs'],
dots: true,
dest: config.versionRoot + '/',
ext: '.html'
}
]
},