-
Notifications
You must be signed in to change notification settings - Fork 5
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
Doesn't find asset paths #4
Comments
That's because the resulting css file gets created by ExtractTextPlugin during the build. I've tried to explain this in this paragraph, but probably I wasn't clear enough. For these generated assets, you should specify the target path (relative to the html file), replacing all variable parts of the path with asterisks. If you have no variable parts (no hashing), just provide the path of the resulting css file. For example, if your The fact that the html file is an entry point may cause additional issues, or may break the build completely, I haven't tested this. So it's better to |
Hmmm, we are using this pattern:
Are you saying I'd need to make a new extract text plugin instance for each of those files? I can't reference the built ones by hash because I don't know what the hash would be. All I really want to achieve is to require static assets from my index file and have the files hashed appropriately. Is that outside the scope of this plugin? I'm a bit new to the webpack dependency graph management nitty gritty, so thank you for the help! |
Thiat's exactly the use case this plugin was written for. No, you don't need to know the hash beforehand. For non-generated assets, you don't need to do anything special except for wrapping paths in
E.g. if, after the build,
I'll fix this, hopefully during this week, and post a comment here to inform you. |
I'm confused - aren't all assets generated by webpack? The built folder that webpack creates is a throw away, it rebuilds it every time. I will never have plain old "ie8.css" hanging out in my built folder. For |
UPD: Sorry for this, probably I need some sleep. You're right, you can't use a single ExtractTextPlugin to emit multiple files. The single instance of ExtractTextPlugin always concatenates all received files to produce a single output file. But But this is the case only if you want to use All other assets (images, fonts, css/sass/less/stylus without |
I've just found a bug that prevents resolving assets if an html file is located in a sub-directory (like |
@delvarworld, I've updated my earlier comment. Sorry for the confusion. |
I've just added another example that builds upon your use-case. However, it doesn't use Does this help? |
Phew! Using
and in my html:
and now it's working for local files:
pretty slick! I think it would be nice if there was a non-jade example in the readme, as well as both local files, entry point files, and webpack built files required in the example. |
Improving the readme and adding more examples, both basic and advanced ones, is definitely in my plans. Unfortunately, now I'm really busy with a bunch of projects, but I'll try to find time as soon as possible. BTW, you can contribute an example or two ;) |
webpack.config.js note NOT using a loader with PathRewriterPlugin:
Folder structure:
Here's index.html:
Here's output:
No combination of file paths seems to work.
The text was updated successfully, but these errors were encountered: