-
-
Notifications
You must be signed in to change notification settings - Fork 206
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
How to turn off minification? #65
Comments
These defaults are terrible: https://github.com/webpack/html-loader/blob/master/index.js#L71-L88
|
I think it would be great if they were configurable but I cant figure out how to do that. Perhaps its a porblem with using it inside HtmlWebpackPlugin |
I use it this way, and that works : { test: /\.html$/, loader: 'html?minimize=false', exclude: [root('src', 'index.html')] }, https://github.com/webpack/html-loader/blob/master/index.js#L68 And yes, I agree, these are very destructive defaults :/ |
hmm. the problem is I'm using it with the Webpack HTML Plugin... |
Me too :) And the HtmlWebpackPlugin does not seem to cause any problem here, it's just html-loader's minimification, at least in my configuration (note that I also have excluded index.html in html-loader's configuration): const BASE_CONFIG = {
plugins: [
new HtmlWebpackPlugin({ template: 'src/index.html' })
],
module: {
loaders: [
{ test: /\.html$/, loader: 'html?minimize=false', exclude: [root('src', 'index.html')] }
]
}
}; |
You can try the following? Please dont mind. i didnt try the code, I could guess this from the code
|
@ccorcos Can i request something? Could you share information on How you specifically opened the code difference at https://github.com/webpack/html-loader/issues/url ? Above comment is my first comment on a open source 💃 yay. and i am curious how you were able to point at specific piece of code. |
So I'm using the html webpack plugin like this: new HtmlWebpackPlugin({
template: `!html!${config.html}`,
inject: 'body',
}), It appears that adding any inline query params causes errors, and when I use something like... htmlLoader: {
removeComments: false,
removeCommentsFromCDATA: false,
removeCDATASectionsFromCDATA: false,
collapseWhitespace: false,
conservativeCollapse: false,
removeAttributeQuotes: false,
useShortDoctype: false,
keepClosingSlash: false,
minifyJS: false,
minifyCSS: false,
removeScriptTypeAttributes: false,
removeStyleTypeAttributes: false
}, ... it doesnt work either. @imvetri When you are looking at code on github, click a line number and it it will get highlighted and change the url. You can also shift-click to another location to highlight a range. |
not working for me either, the html code still get compressed.. |
Can someone help me understand with this condition I suspect this line and it is taking program control inside the IF block all ways. Hence minify=true is not working? |
Whats going on is there are two configurations to effectively turn on minification. One is the htmlLoader field. so if you put |
+1 same problem using HtmlWebpackPlugin - any updates? |
I didnt figure anything out -- at then end of the day, it does work... |
@abelokon There are a few "problems" mentioned here. The original was the defaults for html loader in regards to minification which has been changed. The second was effectively minifing twice. Could you be a bit more specific to which issue you are referencing? |
@d3viant0ne As already mentioned I'm also using HtmlWebpackPlugin and trying figure out how to turn off the minification of my html files. Since the first snippet posted here didn't work for me either, I agreed. |
FYI: Looking at this commit @ index.js:19 It seems that there is an issue with how "configKey" is looked up. The config key is looked up using Edit: In order to disable minimizing, use:
Please correct me if I'm wrong. |
Is there a way that minimize the html string but keep case sensitive?Because i use PascalCase-style to name my components. |
Thanks for reporting, this is fixed in #116. |
Noticed on `enwiki > Javascript`. The collapsed tables borders were gone when using sepia or dark themes. Caused by using the '-p' webpack switch, which caused the CSS to be minified ( webpack-contrib/html-loader#65 (comment) ), which changed the order of CSS, which was important. Specifically, the `ThemeTransform` CSS needs to be 1st, as outlined here https://github.com/wikimedia/wikimedia-page-library/blob/master/src/transform/index.js#L3 and here #128 (comment)
where to write this? |
doesnt seem to work
The text was updated successfully, but these errors were encountered: