mhanberg / jekyll-postcss

A plugin to use PostCSS plugins like Autoprefixer or Tailwind CSS with Jekyll.
MIT License
66 stars 12 forks source link

Would you consider an update to also run Converters::PostCss on .scss files? #4

Closed coreyaus closed 4 years ago

coreyaus commented 4 years ago

I was looking for a solution to add auto-prefixing while also working with SCSS files. I have all my SCSS partials compiling into a single CSS file as I'm importing them all in /assets/css/main.scss.

Given this jekyll-postcss plugin only runs Converters::PostCss on .css files I copied the code from postcss.rb directly to my _plugins directory with one small tweak, changing this line: https://github.com/mhanberg/jekyll-postcss/blob/master/lib/jekyll/converters/postcss.rb#L21 to the following:

ext.casecmp(".css").zero? || ext.casecmp(".scss").zero?

That change ensures the converter correctly adds auto-prefixing to the CSS file generated from /assets/css/main.scss (the final file is created at /assets/css/main.css as per usual). It seems to all be working fine, but if you're happy to help I'd love to know:

  1. Are there any glaring problems with this approach?
  2. Is there a better way to achieve the same result?
  3. If no to points 1 and 2, would you consider adding that change to this gem?

Cheers for all your work on this gem, and thanks in advance for any help you're able to offer to those three questions above!

mhanberg commented 4 years ago

The linked pull request was released with v0.4.0

🍻