Closed andreasisaak closed 7 years ago
My Gruntconfig:
postcss: {
dist: {
options: {
processors: [
require('autoprefixer')({browsers: 'last 4 versions'}),
require('postcss-critical-split')({
save: true
}),
require("css-mqpacker")({sort: true})
]
},
src: ['Resources/Public/Stylesheets/*.css']
}
},
Hey Andreas,
Thanks for posting some code along with your report. That really helps.
All cards on the table: that 'save'-feature was not exactly my brightest idea; it was back in the day when the plugin was heavily based on the postcss-split plugin I forked this from. In hindsight, that was not the postcss-way of doing things.
I'll look into why this isn't working and see if I can fix it but I'll probably be deprecating this feature soon. Postcss plugins shouldn't be saving files to the disk themselves ;)
To address your problem: Here are a few ideas.
output: 'rest'
to the split config doesn't change anything. I'll check to setup up a little grunt-setup that simulates your situation and check out what is going on. If you'd have a demo-setup for me to check this out, it would considerably help me speed things up :)
Hey Andreas,
I quickly set up a test to simulate this and I think you should change your workflow to ignore the save-option. It breaks the grunt flow and totally defeats the point of the postcss plugin framework.
My example: grunt-save-rest.zip (download, open in terminal, run npm install
and then grunt
)
What I did:
Once Grunt has completed running you have 3 files:
main.css
: this is the generated output from the sass file which has also been processed by your autoprefixer and MqPacker.main-critical.css
: this is the critical css only.main-rest.css
: this is the non-critical css that you can load async later.I hope this helps you.
About the 'save'-feature: I have tried moving things around in order to fix this but the truth is that the 'save' feature was never a good approach. It was a leftover approach that I found when I first forked postcss-split. In hindsight, it should never have continued to exist in my version of the plugin as it breaks the way PostCSS flow.
I'll mark this as 'won't fix' as I will deprecate the save feature soon. I still hope I was able to help you out with the above example.
Good luck!
Deprecation notice is in place. There's nothing else to be done here. Closing this :)
I'm working with grunt-postcss and your postcss module and the config output: rest is not working. The output at the css stylesheets is equal to output: critical