middleman / middleman-sprockets

Sprockets support for Middleman
http://middlemanapp.com
MIT License
62 stars 53 forks source link

Middleman 4.3 only supports SassC. Middleman-Sprockets needs to migrate to SassC as well #132

Open tdreyno opened 5 years ago

Valerz commented 5 years ago

Hi,

Do you think this ticket might be the cause of my issue? I'm running middleman-sprockets ~> 4.1.0 In config: If I de-active sprockets, my sass stylesheets work. But my my js (//= require) doesn't work. If I activate sprockets my sass stylesheets break but my js (//= require) works.

tdreyno commented 5 years ago

I expect so. Which version of middleman are you using?

Valerz commented 5 years ago

running middleman 4.3.2

tdreyno commented 5 years ago

@Valerz try dropping down to 4.2.x for now

Valerz commented 5 years ago

@tdreyno no luck on 4.2 either.

looks like a Windows os issue. I've got a colleague on a iOS and works fine for him.

abraham commented 5 years ago

I temporarily worked around this with adding gem 'sass' to Gemfile.

komor72 commented 5 years ago

I stumbled upon this in my project, while trying (mostly successfuly) to upgrade MM 4.2.1 project using Ruby-Sass and Middleman-Sprockets to Mm 4.3.3 and SassC. Same results as @Valerz describes: If I de-active sprockets, my sass stylesheets work. But my my js (//= require) doesn't work. If I activate sprockets my sass stylesheets break (sassc CssSyntaxError: Unknown word) but my js (//= require) works.

Ruby version: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16] Middleman version: middleman (4.3.3) OS version: macOS Mojave (10.14.4)

I understand that there is no solution yet, other than reverting back to my older MM 4.2.x (and Ruby-Sass)? My usage of Sprockets is very basic, only the js //= require, nothing else. I also use activate :minify_javascript in my config, but I guess it works without Sprockets, right?

By the way: why MM 3.3.x is supporting SassC only? Are the changes in the code breaking backwards compatibility with older Ruby-Sass?

tdreyno commented 5 years ago

Ruby-Sass is end of life'd. Everyone is having to switch to SassC. Synchronizing with Sprocket's migration is a headache. I'm not sure where this is now. It might be as simple as upgrading our copy of Sprockets... but that upgrade has always been painful as they assume Rails is their only API consumer.

Pinging @stevenosloan who had taken over maintenance of this repo.

dagumak commented 5 years ago

Ruby-Sass is end of life'd. Everyone is having to switch to SassC. Synchronizing with Sprocket's migration is a headache. I'm not sure where this is now. It might be as simple as upgrading our copy of Sprockets... but that upgrade has always been painful as they assume Rails is their only API consumer.

Pinging @stevenosloan who had taken over maintenance of this repo.

Is there any documentation for a migration path?

jclusso commented 5 years ago

What is the status on this? With larger projects using ruby-sass is abysmally slow.

tdreyno commented 5 years ago

Current status is that this repo is unmaintained. Would happily merge any PR that brought it up to date with modern sprockets (and I assume sassc)

jclusso commented 5 years ago

@tdreyno is there an alternative to this for middleman? Just confused why it's not longer maintained.

tdreyno commented 5 years ago

The frontend world moved away from sprockets to stuff like Webpack. We deprecated support for sprockets in favor of a system which allows arbitrary javascript tooling when version 4 came out (2015): https://middlemanapp.com/advanced/asset-pipeline/

For a while, folks were maintaining this as they migrated to the new system. Seems like its been enough time that it has atrophied entirely. If you look at the Sprockets releases, maintained by the Rails team, it seems that dev has pretty much stopped: https://rubygems.org/gems/sprockets/versions

For modern sites, I don't think you need a pipeline or tooling at all. CSS has a module system (@import) and so does Javascript (ES modules) now.

On some sites, I run tsc --watch with the newer pipeline (https://middlemanapp.com/advanced/external-pipeline/) if I need TypeScript.

jclusso commented 5 years ago

Guess I gotta do some reading and get myself up to date. I use @import for my SASS. Main issue for me is coffeescript requires to be honest.

tdreyno commented 5 years ago

Gotcha. I believe Middleman code will compile your coffee script files (without sprockets) if you have the coffee script gem in your Gemfile. You'd need to find a way to replace the include/require parts with modern JS versions or a module/js compiler like webpack.

You could also downgrade to Middleman 4.2 which doesn't rely on the current version of Sass, so may work well with old sprockets.

jclusso commented 5 years ago

Thanks for the info!

On Sat, Oct 5, 2019 at 3:04 PM Thomas Reynolds notifications@github.com wrote:

Gotcha. I believe Middleman code will compile your coffee script files (without sprockets) if you have the coffee script gem in your Gemfile. You'd need to find a way to replace the include/require parts with modern JS versions or a module/js compiler like webpack.

You could also downgrade to Middleman 4.2 which doesn't rely on the current version of Sass, so may work well with old sprockets.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/middleman/middleman-sprockets/issues/132?email_source=notifications&email_token=AAEX7NFKLJ2NLT6HMBDVRQDQNDQK7A5CNFSM4GVC2J7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEANZRZY#issuecomment-538679527, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEX7NDPJ3V3LD3KRZHQDL3QNDQK7ANCNFSM4GVC2J7A .

-- Regards, Jarrett Lusso

ojundt commented 4 years ago

I was able to get it to work with middleman 4.3.6, middleman-sprockets 4.1.1 and sprockets 3.7.2 by adding this line in config.rb:

::Sprockets::Autoload::Sass = ::SassC

Ugly hack (you still get the warning 'consider using Sprockets 4.x to render with SassC') but it works until we find the time to refactor the asset pipeline.

cabgfx commented 4 years ago

Thanks for sharing that, @ojundt !

asecondwill commented 1 year ago

Just leaving a comment so i can find this again. I couldnt get @ojundt fix to work. it said:

warning: already initialized constant Sprockets::Autoload::Sass == Sprockets will render css with SassC

which it didnt. it just outputted the scss file unprocessed.

Getting a basic bootstrap demo working on a new install of middleman 4 today has been tricky. so giving up on sprockets for now.

pomartel commented 1 year ago

@asecondwill I gave up on Sprockets a fews weeks ago and just use an external pipeline instead with Dart Sass installed through Homebrew. Here is the relevant configuration from my config.rb file:

activate :external_pipeline,
  name: :sass,
  command: "/opt/homebrew/bin/sass --no-source-map #{ build? ? '' : '--watch' } --load-path=node_modules --load-path=source/images source/stylesheets/_application.scss:build/assets/application.css",
  source: "build/assets"

I have something similar to concatenate my JS files. Hope this helps!