Skip to content

Commit

Permalink
Update Rakefile for sass-embedded (dart-sass) (#268)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme authored Jan 11, 2024
1 parent 51396a3 commit 90467de
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ end
desc 'Dumps output to a CSS file for testing'
task :debug do
begin
require 'dartsass-ruby'
require 'sass-embedded'
rescue LoadError
begin
require 'sassc'
Expand All @@ -60,12 +60,14 @@ task :debug do
require 'autoprefixer-rails'
path = Bootstrap.stylesheets_path
%w(_bootstrap _bootstrap-reboot _bootstrap-grid).each do |file|
# For ease of upgrading, the root namespace ::SassC is still used by dartsass-sprockets.
# This is planned to be renamed in a future major version release.
engine = SassC::Engine.new(File.read("#{path}/#{file}.scss"), syntax: :scss, load_paths: [path])
out = File.join('tmp', "#{file[1..-1]}.css")
css = engine.render
filename = "#{path}/#{file}.scss"
css = if defined?(SassC::Engine)
SassC::Engine.new(File.read(filename), filename: filename, syntax: :scss).render
else
Sass.compile(filename).css
end
css = AutoprefixerRails.process(css)
out = File.join('tmp', "#{file[1..-1]}.css")
File.write(out, css)
$stderr.puts Term::ANSIColor.green "Compiled #{out}"
end
Expand Down

0 comments on commit 90467de

Please sign in to comment.