Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecation #168

Closed
esb opened this issue Jul 31, 2020 · 20 comments
Closed

Deprecation #168

esb opened this issue Jul 31, 2020 · 20 comments

Comments

@esb
Copy link

esb commented Jul 31, 2020

Does this mean you're abandoning sprockets-only Rails users?

For some setups, it isn't useful or easy just to switch to Webpacker instead of Sprockets. Do we now lose Autoprefixer support because of this?

@ai
Copy link
Owner

ai commented Jul 31, 2020

Does this mean you're abandoning sprockets-only Rails users?

Yeap. I know that Sprockets is enough for some cases. But since I am supporting too many open source projects, I just do not have time for all of them.

It is hard to choose, but I think you can understand that Sprockets integration is the best candidate. Sprockets time is over. It requires a lot of time to maintain the bridge between Ruby and JS.

@esb
Copy link
Author

esb commented Jul 31, 2020

Is this something that someone else can take over?

I have a massive production environment that cannot simply be switched to Webpacker easily, and having used both I can see there are still excellent reasons in some cases to stick with Sprockets for the moment. I need to find ways to keep this running without major disruption.

@ai
Copy link
Owner

ai commented Jul 31, 2020

You can become a maintainer of Autoprefixer Rails. But it will require a big refactoring, because the latest Browserslist stopped to work with our Node.js to Ruby bridge.

Another option is to write a small Node.js CLI tool to run PostCSS with Autoprefixer. Then you will run it on your ./asserts/*.css files after the Sprockets.

@esb
Copy link
Author

esb commented Jul 31, 2020

I'm happy to look at being a maintainer of this gem. What's the process for building the autoprefixer.js file? I'll have a play around with running a Node.js tool to run PostCSS.

@SpiffyStores
Copy link

I'm happy to look at being a maintainer of this gem. What's the process for building the autoprefixer.js file? I'll have a play around with running a Node.js tool to run PostCSS.

I'd do this through my company account.

@ai
Copy link
Owner

ai commented Aug 1, 2020

What's the process for building the autoprefixer.js file?

  1. Clone postcss/autoprefixer and update Browserslist dependency by calling yarn upgrade-interactive --latest
  2. Clone ai/autoprefixer-rails and create a build script will prepare vendor/autoprefixer.js. You can look at autoprefixer/gulpfile.js for start.
  3. Be sure that this build script works well and tests are passing.
  4. Send PR with a new build script.

@utkarsh2102 maybe you want to take a project maintenance

I'd do this through my company account.

If somebody will prove me with a good PR with new vendor/autoprefixer.js build system that they will support the project well. They can move the project to their org. I just need a links to Autoprefixer and PostCSS from the docs.

@PikachuEXE
Copy link

PikachuEXE commented Aug 3, 2020

I opened #172 with steps to update the vendor/autoprefixer.js
No build script yet

Edit: PR Closed due to not able to use gulp standalone in autoprefixer 10

@PikachuEXE
Copy link

@ai
Can you clarify the expected changes in autoprefixer 10 like the removal of gulp standalone?
It's hard to create a build script without knowing what can or cannot be used

@utkarsh2102
Copy link
Contributor

Hi @ai,

@utkarsh2102 maybe you want to take a project maintenance

I'd love to help out but I am not well-versed with JS yet. And that's why I am a bit hesitant here.
However, I'd be happy to stick around here and help up with things that I can look after! 😄

(that said, I'd be happy to even take care of some JS part with some mentorship if you have time!? :))

@ai
Copy link
Owner

ai commented Aug 3, 2020

Can you clarify the expected changes in autoprefixer 10

  1. Remove Babel. We will serve the current sources in the npm package.
  2. Remove the whole gulpfile.js
  3. Remove PostCSS from dependencies and use a new PostCSS 8 plugin format (I am still thinking about API). In you build you will need to combine PostCSS with Autoprefixer manually: postcss([autoprefixer]).process(…) instead of autoprefixer.process(…).
  4. Drop support for Node.js <8.

@brendon
Copy link

brendon commented Aug 7, 2020

It's great to see some interest in maintaining this project. :)

Is it still reasonable in 2020 to use Sprockets for CSS in a non-frontend-framework Rails app? I'd vote yes :)

However, I was interested in #2 in the deprecation page:

If you have a legacy project, you can write a small Node.js script with postcss and autoprefixer and call it on CSS files after Sprockets build.

Is there some guidance on what that would actually look like? From a quick look, it doesn't seem like sprockets has any kind of hook system with which to trigger a postcss compile.

@ai
Copy link
Owner

ai commented Aug 7, 2020

Is there some guidance on what that would actually look like? From a quick look, it doesn't seem like sprockets has any kind of hook system with which to trigger a postcss compile.

@brendon I suggest running Autoprefixer only on deploy (and not in development).

In this case, just add an extra script to your deploy tool:

rake assets
node ./scripts/autoprefixer

@brendon
Copy link

brendon commented Aug 7, 2020

That makes sense. I guess the only issue would be the potential for differences between the dev environment and production where the latest version of a browser still relies on a prefix but we want to use the non-prefixed version.

mockdeep added a commit to mockdeep/questlog that referenced this issue Aug 15, 2020
Fixed `autoprefixer-rails` to `9.8.5` due to a deprecation warning that
fails the tests. We'll need to see how discussion goes on whether the
project stays alive.

ai/autoprefixer-rails#168
@PikachuEXE
Copy link

Just to share what I did

We have a deploy rake task with tasks like asset precompile, docker image build/push & running ansible playbook
So the following command is run after asset precompile:

# `current_absolute_path` points to a folder created for deployment

%Q|npx postcss "#{File.join(current_absolute_path, "public/assets/**/*.css")}" --map --env production --config #{current_absolute_path} --verbose --replace|

Our postcss.config.js

/* eslint-disable global-require */

module.exports = (ctx) => ({
  map:      ctx.options.map,
  plugins:  [
    require("postcss-preset-env")({
      autoprefixer: {
        flexbox: "no-2009",
      },
      stage: 3,
    }),
    require("cssnano")({
      preset: ["default", {
        calc: {
          // Some vendor like noty for `calc`
          warnWhenCannotResolve: false,
        },
        discardComments: {
          removeAll: true,
        },
      }],
    }),
  ],
})

The only downside right now is what @brendon mentioned but we are fine with it

@albb0920
Copy link
Collaborator

albb0920 commented Sep 9, 2020

We have a few project that relies on sprocket, and we aren't switching to webpack any time soon.
So I'm also very interested in keeping this project alive.

I've submitted #176 as a starting point for supporting next major version of autoprefixer.

@ai
Copy link
Owner

ai commented Sep 9, 2020

@albb0920 Great. This PR looks awesome.

I invited you to the GitHub project. I will keep RubyGems access for a few releases but then will give you access to RubyGems too.

@albb0920
Copy link
Collaborator

Thanks, got it!

Can we drop the deprecation warnings?
If it's OK with you, I'll start a branch for 9.x with the warnings removed and remove the warnings from master as well.

@ai
Copy link
Owner

ai commented Sep 10, 2020

Can we drop the deprecation warnings?

Absolutely. Send PR and remove the wiki page. I will release the patch release.

@ai
Copy link
Owner

ai commented Sep 10, 2020

Do you have a Twitter account to mention you?

@albb0920
Copy link
Collaborator

OK, I'll work on it, thanks!

Yes, you can mention me at @albb0920

dmytro-dobriev pushed a commit to dmytro-dobriev/autoprefixer-rails that referenced this issue Oct 15, 2021
koziiroman pushed a commit to koziiroman/Autoprefixer-RubyOnRails that referenced this issue Apr 4, 2022
BlackSpider8391 added a commit to BlackSpider8391/autoprefixer-rails that referenced this issue Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants