cancel
Showing results for 
Search instead for 
Did you mean: 

Frontools production styles with .min suffix

SOLVED

Frontools production styles with .min suffix

In a recent upgrade of frontools, (here, I believe: https://github.com/SnowdogApps/magento2-frontools/commit/cd12b274523a2211b8588f4932eabdb79554ffd5), the production stylesheet was renamed to include .min. This, unfortunately was a breaking change for us even though the version change was a patch. Currently, we handle the CSS in Magento through the default_head_block.xml. However, with the addition of .min, this doesn't seem like it works as there is now a difference in files names between live and local. For us, I can't think of any benefit in having a disparity of naming, but I could be missing something. I have a few ideas on how to resolve this: fork the repo and manually include it in our project with a config flag to be able to disable the `.min` suffix. I would also submit a PR to correct this breaking change.

 

Or, include the stylesheet in design config in Magento admin. I believe there may be {{variable}} that would parse for the current skin directory but I don't know them right off of the top of my head. 

 

Is there anything that I'm missing here? Is there an approach that would work through CI/CD? 

Tags (2)
6 REPLIES

Re: Frontools production styles with .min suffix

Are you not using CSS minification on production (or production like environments)?

That's was the whole idea behind this change, while you set this option to true (I believe it's good for everyone), M will look for styles.min.css, not styles.css.

Re: Frontools production styles with .min suffix

That makes sense. I wasn't aware that Minify CSS Styles in Magento will append .min to all of the stylesheets that it is loading.

 

We do use CSS minification on production environments, but not through Magento's feature. The CSS handling happens in our CI/CD pipelines so Magento's option didn't seem necessary until this point. From my perspective, the .min suffix isn't integral as long as the stylesheet are indeed minified. That said, I think the Minify CSS option will work fine for us. Thanks again for clarifying this!  

Re: Frontools production styles with .min suffix

Have in mind that this option is global, so i.e. your admin area styles will be minified too (I'm not sure if you are already handling this), same about JS minification, when turned on every *.js file will be *.min.js.

 

Warning: Remember to run our beloved `static:content-deploy` (and/or your custom processors with *.min.* as output) after changing this options.

Re: Frontools production styles with .min suffix

Thanks for the tip. I think it's surprising that the static:content-deploy doesn't have an option to minify. It seems that would be more clear than adding a line to the DB.

 

On that note, I'll still suggest that either an option be added to Frontools to disable the suffix or output both with and without the suffix by default (in --prod). That way, turning on/off Minify CSS in the admin wouldn't break front end styles. Thanks again.

Re: Frontools production styles with .min suffix

Looking forward to pull requests with some clever solution Smiley Happy

Re: Frontools production styles with .min suffix

For future reference, a "fix" for this was merged. https://github.com/SnowdogApps/magento2-frontools/pull/208

 

Add "disableSuffix": "true", in themes.json to stop `--prod` from adding `.min` to minified CSS files.