Closed kbudasov closed 1 year ago
Hello @kbudasov,
to disable JS compilation you can omit the require():
The source./index.js
file will be compiled at processing:
script(src=require('./index.js') defer='defer')
Disable compilation, stay as is:
script(src='./index.js' defer='defer')
If you need to customise the output filename at processing, you can use the js.filename
option as a function.
js: {
// filename - absolute path to source file
// chunk.name - the name of entry key
filename: ({ filename, chunk }) => {
return chunk.name === 'home' ? 'index.html' : '[name].html';
},
}
In my case, I saw the compiled files as the result of normal entrypoints being passed, and inadvertently thought they were the result of the plugin being compiled. Thanks again and sorry for wasting your time.
Hi everyone, first of all, I'd like to thank you for this great solution, it works properly and I wish to use it in my project(s).
But, in my opinion, this plugin missing an option
js: { enable: false }
to prevent compiling javascript.Why do I think so? Because when compiling scripts is mandatory, it looks like our resources are bound hard to each other and it imposes an additional limits. Also, there can be complex projects where this plugin is required to build only
.pug
files, not all the resources.For example, we have the following folders structure, where's all the page assets are in the same folder:
I would like to handle assets in separate tasks; rename files during the compilation using the directory name; create dynamic entryPoints personally without depending on plugin conditions, etc.
Can you please make such an option to make this plugin even better? I can help if need on any question and open for discucss.
Thank you!