-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/loaders #41
Feature/loaders #41
Conversation
Oh, this is awesome! Regarding |
I thought something like |
Open todos:
|
options: self.options, | ||
} | ||
}; | ||
if (self.options.compile === true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not to allow compiler to be replaced instead of using a flag? That seems like a more flexible alternative to me. It could still default to blue imp for backwards compatibility.
If you want to skip compiling altogether, you would just set compiler: id
(pass through).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hey @bebraw thanks for the feedback..
Actually I have a new (hopefully) better idea.
Instead of using a template processing part I will use a blueimp template loader by default.
This will reduce the complexity and will still support blueimp templates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. I'm a happy camper if I can write something like require('html!highlight!markdown!./README.md')
within the template and have it evaluated through Webpack using those loaders.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should already work with this branch however it's not finalised
@bebraw I have just added an example which uses the blueimp loader together with the html loader. This is just an example but should give you an idea how loaders might work together. |
This looks really promising, can't wait for it to be released! Anything I/we can do to speed this up? A thought, why not drop the blueimp dep, and just go with lodash templates? |
@ampedandwired chose blueimp - and I would rather concentrate on the loaders issue first. |
I use handlebars or jade, so it makes no real difference to me. Just thinking that more people are probably familiar with lodash/underscore templates than blueimp. It also allows you to drop a, albeit small, dependency. But yeah, different issue 😄 |
Before releasing I would like to add more examples and use those examples for integration testing. So it would be a great support if you could add some more examples (e.g. underscore, jade, handlebars, mocha-loader, using the chunks option and so on) |
@jantimon That |
I have troubles using jade as template, because I have jade registered in loaders array in webpack.config.js and when I use it for the template it is loaded with blueimp-tmpl. I believe this is because no loaders are detected in the template name? I think, perhaps blueimp-tmpl shouldn't be used by default, only when requested explicitly. Or at least provide option to disable it |
@saberduck This is for backwards compatibility.. Maybe we could add the blue-imp loader to the module loaders so it would become a fallback - but I am not sure if this would would work. |
Maybe, if you can replace this test
with some explicit option like I think I can workaround it by using raw! , but this would be nicer imho |
Why can't you just use jade!template.html ? Right now the 1.x branch uses blueimp templates by default. |
because I have jade loader defined as loader for .jade files in module.loaders array. If I specify |
thanks for the reporting - I have to look into that 👍 |
I will try to setup some minimalistic project to show you my problem, maybe I am missing something and problem is somewhere else, ttyl |
Cool - let me know I'll look into it |
534b313
to
7f63ba8
Compare
@saberduck - fixed that. It will use only a loader if you haven't specified one |
Excellent work! I'm very much looking forward to being able to use this |
Looks great now, thanks! Sorry, I didn't have time for the minimal test-case to reproduce the issue I had before |
@SimenB do you mean like below, with a custom key name?
The result is what I would expect: But previously with the |
Just new HtmlWebpackPlugin({
template: "app/index.html"
}) and the <link rel="shortcut icon" href="./path/to/favicon.ico"> That works with hbs at least, should be the same for lodash |
@SimenB thanks for getting back. With your code, it's just hard coding to a predetermined path, no? I suppose we would use it with the |
Yup, that's right. I prefer having it in code and not in configuration, anyways 😄 |
Does This work
But
Don't work |
@jantimon
The important part:
|
@jantimon You can include the whole |
@SimenB Good point 👍 will do :) |
Created a PR for it |
I've been trying to grok the samples and this PR's code, but haven't made it yet. I want to transform this: |
@haf, you can use something like html-loader or underscore-template-loader for this. When you have this installed, you can just use a |
@SpaceK33z considering backwards compatibility and stability of underscore-template-loader - is there any reason why we should not use underscore-template-loader as default loader for this plugin? |
@jantimon, I don't think there's a good reason not to use it. It's lightweight and I think stable enough. Using it as default loader would certainly be interesting! |
Child compilation must use a separate cache object
Windows support
Release 2.6.5
I am about to release 2.x - do you see any open points which should be addressed first? |
@jantimon do it! |
Yay! Please do :) |
Fuck yeah, good work @jantimon! 🎉🎉🎉 |
We had an issue in development on rebuilds after jumping from 2.0.4 to 2.6.something (don't remember exact version ottomh) when using custom handlebars. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This rather big pull request will allow to use loaders #10 :
Further changes to get this working:
templateParams.htmlWebpackPlugin.assets
.templateContent
feature. (Maybe we can fix this)inject
totrue
by defaultThis merge request is work in progress and will need some more testing and cleanup.