Comments (6)
Fixed in 6ae0e85. You can get a hold of the publicPath through {%=o.webpackConfig.output.publicPath%}
.
from html-webpack-plugin.
Cheers, glad you like the plugin.
The options object that you pass into the plugin is available in the template, so you could expose the public path through that. Not the cleanest solution and I'll probably add a better way to do this, but it should work. Here is an example:
webpack.config.js
var myPublicPath = '/public/';
var webpackConfig = {
output: {
publicPath: myPublicPath
}
plugins: [
new HtmlWebpackPlugin({
template: './my_index.html',
publicPath: myPublicPath
})
]
};
my_index.html:
<link rel="stylesheet" href="{%=o.htmlWebpackPlugin.options.publicPath%}{%=o.webpack.assetsByChunkName.client[1]%}"/>
from html-webpack-plugin.
That's exactly how I did. :)
But it would be nice not having to duplicate that option (webpack config + HTMLWebpack config), when several people work in the project, someone ought to forget about the duplicated option.
from html-webpack-plugin.
@Couto see above PR.
from html-webpack-plugin.
Great work! I will test those new features later at night. Thanks 👍
from html-webpack-plugin.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
from html-webpack-plugin.
Related Issues (20)
- templateContent function did not get headTags added in afterTemplateExecution HOT 1
- Insert just defer, not defer=defer HOT 1
- Ability to pass extra plugins to the child compilation HOT 5
- Ability to escape relative urls HOT 1
- How to bundle all of app's templates, styles and scripts into one single .js file, that can be exported as a library and attached to another HTML file and load?
- Is it possible to inject HTML code built from `.ejs` template into js while building and bundling with webpack? HOT 3
- Request sitemap.txt generation HOT 5
- Pre release libraries not working
- Don't update static link file in template.html HOT 1
- Writing Your Own Templates section does not work HOT 2
- ```[tasklist] ### My tasks - [ ] https://github.com/octo-org/octo-repo/issues/45 - [ ] Draft task ```
- Embed the script into HTML HOT 4
- Add a link rel=prefetch for a css chunks created within your wepbackPrefetch lazy loaded js chunks HOT 2
- Watch mode memory leak when saving HTML template HOT 1
- multi-page behavior illogical? HOT 1
- Memory leak in watch mode due to unique child compiler IDs HOT 1
- New version 5.6.0 introduce breaking changes to the plugin interface HOT 3
- CSS order not correct when using split chunks HOT 1
- File does not render correctly / cannot get variable from options HOT 3
- Allow plugin to run during a custom stage, or change default HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from html-webpack-plugin.