runjuu/html-inline-css-webpack-plugin

CSS files are deleted when using together with CopyWebpackPlugin

creage opened this issue · 8 comments

In my webpack config I have my main entry with HTML+CSS, and I want this CSS to be injected. I use simple

new HtmlInlineCSSWebpackPlugin()

for doing this, and it works fine.

I also have a CopyWebpackPlugin, which copies some third party lib, which includes HTML+CSS files in its assets.

These CSS files are removed when being copied. They are not removed if I use leaveCSSFile: true, but then the CSS file from main entry is not removed either.

I wonder why does this plugin deal with files from other plugin? But even if it does - I would expect these CSS get injected correctly in all HTML+CSS pairs it deals with. Currently it only REMOVES all of CSS files, without injecting them.

Hi @creage, Sorry for the delayed response. Can you provide a minimal demo to reproduce the issue?

@runjuu here you go html-inline-css-webpack-plugin-broken

npm i
npm run build

Then check contents of dest/vendor folder. It should have both index.html and index.css, but has .html file only.

BTW, filtering on assets also works 😃

new HtmlInlineCSSWebpackPlugin({
	filter(name) {
		// don't mess the vendor styles!
		return !name.includes('vendor');
	}
})

Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

Any progress on this issue?

@creage There’s been no progress so far 😢

Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

Hello 👋, this issue has been opened for more than 2 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically