rmrevin / yii2-minify-view

Yii2 View component with minification css & js
MIT License
191 stars 67 forks source link

AJAX / Duplicated CSS file #67

Open cluwong opened 5 years ago

cluwong commented 5 years ago

I have a page where some parts of the content is fetched via AJAX. When all assets are minified, the ajax content includes link to a css file which has already been included in the minified file. This is causing an issue if there are customized style defined for a specific class, and that is overwritten by this css file.

Eg, the ajax content displays bootstrap Progress widget which requires bootstrap.css. This css file has already been minified. In the html output for the ajax section there's additional html <link href="/minify/(random string).css" rel="stylesheet">.

If concatCSS property is set to false, this line does NOT appear in the output and the page is displayed as intended. It seems somehow the ajax page knows that the file has already been included in the main page. Can this be fixed when concatCss property is set to true? Or is there a workaround solution not to minify asset files?

kwazaro commented 5 years ago

As I understand, you can exclude such assets from minification, by using the component's configuration property 'excludeFiles' or even exclude specific AssetBundle by using excludeBundles

cluwong commented 5 years ago

Thanks @kwazaro . Using excludeFiles is good for now as workaround solution - the specific file is not included in the minify and hence not duplicate in the ajax content.

It'd be nice to permanently fix so that the file can be included in the minified file and not duplicated.