Skip to content

Commit bef25dc

Browse files
committed
- Remove deprecated SASS and use plain CSS
1 parent d4959f5 commit bef25dc

13 files changed

Lines changed: 75 additions & 89 deletions

File tree

Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ group :development do
1717
gem 'rspec_approvals'
1818
gem 'runfile'
1919
gem 'runfile-tasks'
20+
gem 'sasstool'
2021
gem 'simplecov'
2122
gem 'yard'
22-
23+
2324
end
2425

2526
gemspec

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,14 @@ option.
248248
$ madness --theme my_theme
249249
```
250250

251+
Note that the generated theme contains the SCSS files in the `styles`
252+
subfolder, and the rendered CSS files in the `public/css` subfolder.
253+
254+
If you wish to use the SCSS files, you will need to render them yourself
255+
to the location of your theme styles (e.g. `public/css`) - you can use
256+
any tool to do so, or if you do not have a preference, use
257+
[SassTool][sasstool].
258+
251259

252260
### Option 2: Change CSS only
253261

@@ -300,4 +308,5 @@ For more information about the docker image, see:
300308
[dockerfile]: https://github.com/DannyBen/docker-madness
301309
[css]: app/public/css/main.css
302310
[app]: app
311+
[sasstool]: https://github.com/DannyBen/sasstool
303312

Runfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
require_relative 'lib/madness'
2+
require "sasstool"
23
require "runfile-tasks"
34

45
title "Madness Runfile"
@@ -9,6 +10,13 @@ RunfileTasks::RubyGems.all 'madness'
910
RunfileTasks::Testing.rspec
1011
RunfileTasks::Docs.rdoc
1112

13+
help "Generate public CSS"
14+
action :css do
15+
target = "app/public/css"
16+
Sasstool::Renderer.new("app/styles/main.scss").save target
17+
say "Saved #{target}"
18+
end
19+
1220
help "Run YARD server"
1321
action :yard do
1422
run "yard server -p3000 -B0.0.0.0 -r"

app/public/css/main.css

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/public/css/main.css.map

Lines changed: 44 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/madness/server_base.rb

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# require 'sinatra/reloader'
22
require 'rack/ssl'
3-
require 'sass'
4-
require 'sass/plugin/rack'
53
require 'sinatra/base'
64
require 'slim'
75

@@ -14,20 +12,10 @@ class ServerBase < Sinatra::Application
1412
helpers ServerHelper
1513

1614
Slim::Engine.set_options pretty: true
17-
use Sass::Plugin::Rack
1815
use Rack::SSL if ENV['MADNESS_FORCE_SSL']
1916
set :root, File.expand_path('../../', __dir__)
20-
set :server, :puma
2117
set :environment, ENV['MADNESS_ENV'] || :production
22-
23-
# TODO: Uncomment when the upstream issue is resolved
24-
# At this time, we cannot use reloader, since it prints deprecation
25-
# warnings in Ruby 2.7
26-
# ref: https://github.com/sinatra/sinatra/issues/1590
27-
# configure :development do
28-
# register Sinatra::Reloader
29-
# also_reload "#{__dir__}/*.rb"
30-
# end
18+
set :server, :puma
3119

3220
# Since we cannot use any config values in the main body of the class,
3321
# since they will be updated later, we need to set anything that relys
@@ -48,8 +36,6 @@ def self.set_tempalate_locations
4836

4937
set :views, theme.views_path
5038
set :public_folder, theme.public_path
51-
Sass::Plugin.options[:template_location] = theme.css_source_path
52-
Sass::Plugin.options[:css_location] = theme.css_target_path
5339
end
5440

5541
def self.set_basic_auth

lib/madness/theme.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@ def public_path
1414
custom? ? "#{path}/public" : File.expand_path('../../app/public', __dir__)
1515
end
1616

17-
def css_source_path
18-
custom? ? "#{path}/styles" : 'app/styles'
19-
end
20-
21-
def css_target_path
22-
custom? ? "#{path}/public/css" : 'app/public/css'
23-
end
24-
2517
def custom?
2618
@custom ||= (path and Dir.exist? path)
2719
end

madness.gemspec

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,11 @@ Gem::Specification.new do |s|
2222
s.add_runtime_dependency 'commonmarker', '~> 0.20'
2323
s.add_runtime_dependency 'docopt', '~> 0.6'
2424
s.add_runtime_dependency 'ferret', '~> 0.11'
25-
s.add_runtime_dependency 'json', '~> 2.1'
2625
s.add_runtime_dependency 'naturally', '~> 2.2'
2726
s.add_runtime_dependency 'os', '~> 1.0'
2827
s.add_runtime_dependency 'puma', '~> 5.1'
2928
s.add_runtime_dependency 'rack-ssl', '~> 1.4'
3029
s.add_runtime_dependency 'requires', '~> 0.1'
31-
s.add_runtime_dependency 'sass', '~> 3.7'
3230
s.add_runtime_dependency 'sinatra', '~> 2.0', '>= 2.0.5'
3331
s.add_runtime_dependency 'slim', '~> 4.0'
3432
s.add_runtime_dependency 'extended_yaml', '~> 0.2'

spec/fixtures/cli/theme-ls

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
---
22
- tmp/theme-test/public
3+
- tmp/theme-test/public/css
4+
- tmp/theme-test/public/css/main.css
5+
- tmp/theme-test/public/css/main.css.map
36
- tmp/theme-test/public/favicon.ico
47
- tmp/theme-test/public/fonts
58
- tmp/theme-test/public/fonts/fontello.eot

spec/madness/sass_spec.rb

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)