blazingly fast sass compilation

This commit is contained in:
Lorin Werthen 2018-10-20 23:52:17 +02:00
parent 04461208e9
commit dffa91056f
No known key found for this signature in database
GPG key ID: F11FFC921E0E08E0
5 changed files with 25 additions and 14 deletions

View file

@ -10,7 +10,7 @@ gem 'coffee-script'
gem 'icalendar' # ical files
gem 'kramdown'
gem 'rainpress'
gem 'sass'
gem 'sassc'
gem 'typogruby'
# Needed for atom_feed in blogging helper

View file

@ -81,17 +81,16 @@ GEM
public_suffix (3.0.3)
rack (2.0.5)
rainpress (1.0.1)
rake (12.3.1)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
ref (2.0.0)
ruby_dep (1.5.0)
rubypants (0.7.0)
sass (3.5.6)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sassc (2.0.0)
ffi (~> 1.9.6)
rake
shellany (0.0.1)
slow_enumerator_tools (1.1.0)
terminal-notifier (2.0.0)
@ -127,7 +126,7 @@ DEPENDENCIES
nanoc
pandoc-ruby
rainpress
sass
sassc
terminal-notifier
terminal-notifier-guard
therubyracer

18
Rules
View file

@ -164,12 +164,12 @@ end
#
compile '/assets/scripts/**/*.coffee' do
filter :coffeescript
filter :uglify_js
filter :uglify_js if production?
write ext: 'js'
end
compile '/assets/scripts/**/*.js' do
filter :uglify_js, harmony: true
filter :uglify_js, harmony: true if production?
end
ignore '/assets/stylesheets/includes/**/*'
@ -177,14 +177,22 @@ ignore '/data/**/*'
ignore '/node_modules/**/*'
compile '/assets/stylesheets/**/*.scss' do
filter :sass, syntax: :scss, style: :compressed
sass_opts = {
syntax: :scss,
load_paths: ['content/assets/stylesheets']
}
sass_opts[:style] = :compressed if production?
filter :sassc, sass_opts
filter :autoprefixer if production?
write ext: 'css'
end
compile '/assets/stylesheets/**/*.css' do
filter :rainpress
filter :autoprefixer if production?
if production?
filter :rainpress
filter :autoprefixer
end
write ext: 'css'
end

View file

@ -1,7 +1,7 @@
@import "includes/variables";
@import "../../../node_modules/bulma/bulma";
@import "../../../node_modules/bulma-divider/divider";
@import "node_modules/bulma/bulma";
@import "node_modules/bulma-divider/divider";
.nav-right {
flex: none;

4
lib/filters/sassc.rb Normal file
View file

@ -0,0 +1,4 @@
require 'sassc'
Nanoc::Filter.define(:sassc) do |content, params|
SassC::Engine.new(content, params).render
end