dassets-sass 0.1.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d08aa0461ada11e0191c31924261dc18385ba04fced4c358e0ce26344bbaf92f
4
+ data.tar.gz: c5d2e6f4c15e208c5a0a0d4cebfea7dbe33f90af260d11b9135d6fd209cea7eb
5
+ SHA512:
6
+ metadata.gz: e158fcde26c62ce7563fbcb62705dc59c4d807c74da9365304be1e35ffc1e2052fb9905f13487291bea57d10aac59858f44671267ab66498ba2487aa6eb577a6
7
+ data.tar.gz: 5a013f4695100de302bbf43a32f88e41eaeee34f97d74b53fbf943210fc75952584f96bbe87f48e0e7ed19c73d91242ecc76357abe95e04b1bf0c22e1ee8f395
data/Gemfile CHANGED
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
5
+ ruby "~> 2.5"
6
+
3
7
  gemspec
4
8
 
5
- gem 'rake'
6
- gem 'pry'
7
- gem 'dassets', :github => 'redding/dassets'
9
+ gem "pry"
File without changes
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # DassetsSass
1
+ # Dassets::Sass
2
2
 
3
- Dassets [engine](https://github.com/redding/dassets#compiling) for compiling [Sass](http://sass-lang.com/) css sources.
3
+ Dassets [engine](https://github.com/redding/dassets#compiling) to compile dynamic asset filtes written with [SASS/SCSS](http://sass-lang.com/) using [libsass](https://github.com/sass/sassc-ruby).
4
4
 
5
5
  ## Usage
6
6
 
@@ -8,28 +8,41 @@ Register the engine:
8
8
 
9
9
  ```ruby
10
10
  # in config/assets.rb
11
- require 'dassets'
12
- require 'dassets-sass'
11
+ require "dassets"
12
+ require "dassets-sass"
13
13
 
14
14
  Dassets.configure do |c|
15
- c.root_path '/some/root/path'
16
-
17
- # register for `scss` syntax
18
- c.engine 'scss', Dassets::Sass::Engine, :syntax => 'scss'
19
-
20
- # register for `sass` syntax
21
- c.engine 'sass', Dassets::Sass::Engine, :syntax => 'sass'
22
-
15
+ c.source "/path/to/assets") do |s|
16
+ # register for `scss` syntax
17
+ s.engine "scss", Dassets::Sass::Engine, syntax: Dassets::Sass::SCSS
18
+
19
+ # register for `sass` syntax
20
+ s.engine "sass", Dassets::Sass::Engine, syntax: Dassets::Sass::SASS
21
+
22
+ # by default Dassets::Sass::NESTED output style is used, but you can
23
+ # specify a custom style (http://sass-lang.com/documentation/file.SASS_REFERENCE.html#output_style)
24
+ s.engine "scss", Dassets::Sass::Engine, {
25
+ ...
26
+ output_style: Dassets::Sass::COMPRESSED
27
+ }
28
+
29
+ # by default `/path/to/assets` is in the load path, but
30
+ # you can specify additional custom load paths to use with `@import`s
31
+ s.engine "scss", Dassets::Sass::Engine, {
32
+ ...
33
+ load_paths: ["/custom/load/path"]
34
+ }
35
+ end
23
36
  end
24
37
  ```
25
38
 
26
- Put your `.scss` and `.sass` source files in your source path and digest them. Dassets will compile their content using Sass, switch their extension to `.css`, and write the output to the output path.
39
+ Put your `.scss` and `.sass` source files in your source path. Dassets will compile their content using Sass, switch their extension to `.css`, and write the output to the output path.
27
40
 
28
41
  ## Installation
29
42
 
30
43
  Add this line to your application's Gemfile:
31
44
 
32
- gem 'dassets-sass'
45
+ gem "dassets-sass"
33
46
 
34
47
  And then execute:
35
48
 
@@ -1,5 +1,7 @@
1
1
  # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
2
+ # frozen_string_literal: true
3
+
4
+ lib = File.expand_path("../lib", __FILE__)
3
5
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
6
  require "dassets-sass/version"
5
7
 
@@ -8,21 +10,20 @@ Gem::Specification.new do |gem|
8
10
  gem.version = Dassets::Sass::VERSION
9
11
  gem.authors = ["Kelly Redding", "Collin Redding"]
10
12
  gem.email = ["kelly@kellyredding.com", "collin.redding@me.com"]
11
- gem.description = %q{Dassets engine for compiling Sass}
12
- gem.summary = %q{Dassets engine for compiling Sass}
13
+ gem.summary = "Dassets engine for compiling Sass"
14
+ gem.description = "Dassets engine for compiling Sass"
13
15
  gem.homepage = "http://github.com/redding/dassets-sass"
16
+ gem.license = "MIT"
17
+
18
+ gem.files = `git ls-files | grep "^[^.]"`.split($INPUT_RECORD_SEPARATOR)
14
19
 
15
- gem.files = `git ls-files`.split($/)
16
20
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
21
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
22
  gem.require_paths = ["lib"]
19
23
 
20
- gem.add_development_dependency("assert")
21
-
22
- # lock in to Sass 3.1 and up b/c this is earliest version implementing
23
- # the expected `Sass.compile` api:
24
- # https://github.com/nex3/sass/commit/332dd6945a8acd660719e0ea4eb48ae3a3ef9b38
25
- gem.add_dependency("sass", ["~> 3.1"])
26
- gem.add_dependency("dassets")
24
+ gem.add_development_dependency("much-style-guide", ["~> 0.6.0"])
25
+ gem.add_development_dependency("assert", ["~> 2.19.3"])
27
26
 
27
+ gem.add_dependency("dassets", ["~> 0.15.1"])
28
+ gem.add_dependency("sassc", ["~> 2.0"])
28
29
  end
@@ -1,23 +1,72 @@
1
- require 'sass'
2
- require 'dassets/engine'
1
+ # frozen_string_literal: true
2
+
3
+ require "sassc"
4
+ require "dassets/engine"
3
5
  require "dassets-sass/version"
4
6
 
5
7
  module Dassets::Sass
8
+ def self.SASS
9
+ "sass"
10
+ end
11
+
12
+ def self.SCSS
13
+ "scss"
14
+ end
15
+
16
+ def self.NESTED
17
+ "nested"
18
+ end
19
+
20
+ def self.EXPANDED
21
+ "expanded"
22
+ end
6
23
 
7
- class Engine < Dassets::Engine
24
+ def self.COMPACT
25
+ "compact"
26
+ end
27
+
28
+ def self.COMPRESSED
29
+ "compressed"
30
+ end
31
+ end
8
32
 
9
- def syntax
10
- (self.opts[:syntax] || self.opts['syntax'] || 'scss').to_s
11
- end
33
+ class Dassets::Sass::Engine < Dassets::Engine
34
+ def syntax
35
+ (
36
+ opts[:syntax] ||
37
+ opts["syntax"] ||
38
+ Dassets::Sass.SCSS
39
+ ).to_s
40
+ end
12
41
 
13
- def ext(input_ext)
14
- 'css'
15
- end
42
+ def output_style
43
+ (
44
+ opts[:output_style] ||
45
+ opts["output_style"] ||
46
+ Dassets::Sass.NESTED
47
+ ).to_s
48
+ end
16
49
 
17
- def compile(input_content)
18
- ::Sass.compile(input_content, :syntax => self.syntax.to_sym)
19
- end
50
+ def load_paths
51
+ @load_paths ||=
52
+ begin
53
+ [opts["source_path"]] +
54
+ [*(opts[:load_paths] || opts["load_paths"] || [])]
55
+ end
56
+ end
20
57
 
58
+ def ext(_input_ext)
59
+ "css"
21
60
  end
22
61
 
62
+ def compile(input_content)
63
+ SassC::Engine
64
+ .new(
65
+ input_content,
66
+ syntax: syntax.to_sym,
67
+ style: output_style.to_sym,
68
+ load_paths: load_paths,
69
+ )
70
+ .render
71
+ end
23
72
  end
@@ -1,4 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dassets; end
4
+
2
5
  module Dassets::Sass
3
- VERSION = "0.1.0"
6
+ VERSION = "0.5.1"
4
7
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # this file is automatically required when you run `assert`
2
4
  # put any test helpers here
3
5
 
@@ -5,14 +7,12 @@
5
7
  $LOAD_PATH.unshift(File.expand_path("../..", __FILE__))
6
8
 
7
9
  # require pry for debugging (`binding.pry`)
8
- require 'pry'
10
+ require "pry"
9
11
 
10
- ENV['DASSETS_TEST_MODE'] = 'yes'
11
- ENV['DASSETS_ASSETS_FILE'] = 'test/support/config/assets'
12
- require 'dassets'
13
- Dassets.init
12
+ require "test/support/factory"
14
13
 
15
- require 'test/support/factory'
16
14
  class Assert::Context
17
- setup{ @factory = Dassets::Sass::Factory }
15
+ setup{ @factory = Factory }
18
16
  end
17
+
18
+ ENV["DASSETS_TEST_MODE"] = "yes"
@@ -1,37 +1,36 @@
1
- module Dassets::Sass
1
+ # frozen_string_literal: true
2
2
 
3
- module Factory
4
- module_function
3
+ require "assert/factory"
5
4
 
6
- def scss
7
- "$blue: #3bbfce;\n"\
8
- "$margin: 16px;\n"\
9
- ".border {\n"\
10
- " padding: $margin / 2;\n"\
11
- " margin: $margin / 2;\n"\
12
- " border-color: $blue;\n"\
13
- "}\n"
14
- end
5
+ module Factory
6
+ extend Assert::Factory
15
7
 
16
- def scss_compiled
17
- ".border {\n"\
18
- " padding: 8px;\n"\
19
- " margin: 8px;\n"\
20
- " border-color: #3bbfce; "\
21
- "}\n"
22
- end
23
-
24
- def sass
25
- "table.hl\n"\
26
- " margin: 2em 0\n"\
27
- end
8
+ def self.scss
9
+ "$blue: #3bbfce;\n"\
10
+ "$margin: 16px;\n"\
11
+ ".border {\n"\
12
+ " padding: $margin / 2;\n"\
13
+ " margin: $margin / 2;\n"\
14
+ " border-color: $blue;\n"\
15
+ "}\n"
16
+ end
28
17
 
29
- def sass_compiled
30
- "table.hl {\n"\
31
- " margin: 2em 0; "\
32
- "}\n"\
33
- end
18
+ def self.scss_compiled
19
+ ".border {\n"\
20
+ " padding: 8px;\n"\
21
+ " margin: 8px;\n"\
22
+ " border-color: #3bbfce; "\
23
+ "}\n"
24
+ end
34
25
 
26
+ def self.sass
27
+ "table.hl\n"\
28
+ " margin: 2em 0\n"\
35
29
  end
36
30
 
31
+ def self.sass_compiled
32
+ "table.hl {\n"\
33
+ " margin: 2em 0; "\
34
+ "}\n"\
35
+ end
37
36
  end
File without changes
@@ -0,0 +1,121 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "assert"
4
+ require "dassets-sass"
5
+
6
+ require "dassets/engine"
7
+ require "sassc"
8
+
9
+ module Dassets::Sass
10
+ class UnitTests < Assert::Context
11
+ desc "Dassets::Sass"
12
+ subject{ unit_class }
13
+
14
+ let(:unit_class){ Dassets::Sass }
15
+
16
+ should "know its CONSTANTS" do
17
+ assert_that(unit_class.SASS).equals("sass")
18
+ assert_that(unit_class.SCSS).equals("scss")
19
+ assert_that(unit_class.NESTED).equals("nested")
20
+ assert_that(unit_class.EXPANDED).equals("expanded")
21
+ assert_that(unit_class.COMPACT).equals("compact")
22
+ assert_that(unit_class.COMPRESSED).equals("compressed")
23
+ end
24
+ end
25
+
26
+ class EngineTests < UnitTests
27
+ desc "Engine"
28
+ subject{ engine_class }
29
+
30
+ let(:engine_class){ unit_class::Engine }
31
+ end
32
+
33
+ class EngineInitTests < EngineTests
34
+ desc "when init"
35
+ subject{ engine_class.new }
36
+
37
+ setup do
38
+ @lp1 = "/a-load-path-1"
39
+ @lp2 = "/a-load-path-2"
40
+ end
41
+
42
+ should have_imeths :syntax, :output_style, :load_paths
43
+
44
+ should "be a Dassets engine" do
45
+ assert_that(subject).is_kind_of(Dassets::Engine)
46
+ assert_that(subject).responds_to("ext")
47
+ assert_that(subject).responds_to("compile")
48
+ end
49
+
50
+ should "default its settings" do
51
+ assert_that(subject.syntax).equals(Dassets::Sass.SCSS)
52
+ assert_that(subject.output_style).equals(Dassets::Sass.NESTED)
53
+ assert_that(subject.load_paths).equals([subject.opts["source_path"]])
54
+ end
55
+
56
+ should "allow specifying a custom settings" do
57
+ engine =
58
+ engine_class.new(
59
+ syntax: Dassets::Sass.SASS,
60
+ output_style: Dassets::Sass.COMPRESSED,
61
+ )
62
+ assert_that(engine.syntax).equals(Dassets::Sass.SASS)
63
+ assert_that(engine.output_style).equals(Dassets::Sass.COMPRESSED)
64
+ end
65
+
66
+ should "allow specifying custom load paths, always including the "\
67
+ "source path" do
68
+ engine = engine_class.new(load_paths: @lp1)
69
+ assert_that(engine.load_paths).includes(@lp1)
70
+ assert_that(engine.load_paths).includes(subject.opts["source_path"])
71
+
72
+ engine = engine_class.new("load_paths" => [@lp1])
73
+ assert_that(engine.load_paths).includes(@lp1)
74
+ assert_that(engine.load_paths).includes(subject.opts["source_path"])
75
+
76
+ engine = engine_class.new("load_paths" => [@lp1, @lp2])
77
+ assert_that(engine.load_paths).includes(@lp1)
78
+ assert_that(engine.load_paths).includes(@lp2)
79
+ assert_that(engine.load_paths).includes(subject.opts["source_path"])
80
+ end
81
+
82
+ should "transform any input extension to `css`" do
83
+ assert_that(subject.ext("scss")).equals("css")
84
+ assert_that(subject.ext("sass")).equals("css")
85
+ assert_that(subject.ext("sassycss")).equals("css")
86
+ assert_that(subject.ext("whatever")).equals("css")
87
+ end
88
+
89
+ should "use its syntax, output style and load paths when compiling" do
90
+ load_paths = [@lp1]
91
+ sass_engine =
92
+ engine_class.new(
93
+ syntax: Dassets::Sass.SASS,
94
+ output_style: Dassets::Sass.COMPRESSED,
95
+ load_paths: load_paths,
96
+ )
97
+
98
+ render_spy =
99
+ Assert.stub_spy(::SassC::Engine, :new, render: "rendered output")
100
+
101
+ input = @factory.sass
102
+ output = sass_engine.compile(input)
103
+
104
+ assert_that(output).equals("rendered output")
105
+ assert_that(render_spy.new_called_with.pargs).equals([input])
106
+ assert_that(render_spy.new_called_with.kargs)
107
+ .equals(
108
+ syntax: Dassets::Sass.SASS.to_sym,
109
+ style: Dassets::Sass.COMPRESSED.to_sym,
110
+ load_paths: ([sass_engine.opts["source_path"]] + load_paths),
111
+ )
112
+ end
113
+
114
+ should "compile any input content as Sass CSS" do
115
+ assert_equal @factory.scss_compiled, subject.compile(@factory.scss)
116
+
117
+ sass_engine = engine_class.new(syntax: Dassets::Sass.SASS)
118
+ assert_equal @factory.sass_compiled, sass_engine.compile(@factory.sass)
119
+ end
120
+ end
121
+ end
File without changes
metadata CHANGED
@@ -1,136 +1,117 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: dassets-sass
3
- version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 0
10
- version: 0.1.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.1
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Kelly Redding
14
8
  - Collin Redding
15
9
  autorequire:
16
10
  bindir: bin
17
11
  cert_chain: []
18
-
19
- date: 2013-05-01 00:00:00 Z
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- name: assert
12
+ date: 2021-01-10 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: much-style-guide
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 0.6.0
21
+ type: :development
23
22
  prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 0.6.0
28
+ - !ruby/object:Gem::Dependency
29
+ name: assert
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: 2.19.3
33
35
  type: :development
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: sass
37
36
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
39
- none: false
40
- requirements:
41
- - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 5
44
- segments:
45
- - 3
46
- - 1
47
- version: "3.1"
48
- type: :runtime
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: 2.19.3
42
+ - !ruby/object:Gem::Dependency
51
43
  name: dassets
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: 0.15.1
49
+ type: :runtime
52
50
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
54
- none: false
55
- requirements:
56
- - - ">="
57
- - !ruby/object:Gem::Version
58
- hash: 3
59
- segments:
60
- - 0
61
- version: "0"
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: 0.15.1
56
+ - !ruby/object:Gem::Dependency
57
+ name: sassc
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '2.0'
62
63
  type: :runtime
63
- version_requirements: *id003
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '2.0'
64
70
  description: Dassets engine for compiling Sass
65
- email:
71
+ email:
66
72
  - kelly@kellyredding.com
67
73
  - collin.redding@me.com
68
74
  executables: []
69
-
70
75
  extensions: []
71
-
72
76
  extra_rdoc_files: []
73
-
74
- files:
75
- - .gitignore
77
+ files:
76
78
  - Gemfile
77
- - LICENSE.txt
79
+ - LICENSE
78
80
  - README.md
79
- - Rakefile
80
81
  - dassets-sass.gemspec
81
82
  - lib/dassets-sass.rb
82
83
  - lib/dassets-sass/version.rb
83
84
  - log/.gitkeep
84
85
  - test/helper.rb
85
- - test/support/app/assets/from_sass.sass
86
- - test/support/app/assets/from_scss.scss
87
- - test/support/config/assets.rb
88
86
  - test/support/factory.rb
89
- - test/support/public/from_sass-7173fff1fe11e06f1339beceaf4a9857.css
90
- - test/support/public/from_scss-ffcdabded94a78022e9c92e06e311f69.css
91
- - test/system/digest_tests.rb
92
- - test/unit/engine_tests.rb
87
+ - test/system/.keep
88
+ - test/unit/dassets-sass_tests.rb
93
89
  - tmp/.gitkeep
94
90
  homepage: http://github.com/redding/dassets-sass
95
- licenses: []
96
-
91
+ licenses:
92
+ - MIT
93
+ metadata: {}
97
94
  post_install_message:
98
95
  rdoc_options: []
99
-
100
- require_paths:
96
+ require_paths:
101
97
  - lib
102
- required_ruby_version: !ruby/object:Gem::Requirement
103
- none: false
104
- requirements:
98
+ required_ruby_version: !ruby/object:Gem::Requirement
99
+ requirements:
105
100
  - - ">="
106
- - !ruby/object:Gem::Version
107
- hash: 3
108
- segments:
109
- - 0
110
- version: "0"
111
- required_rubygems_version: !ruby/object:Gem::Requirement
112
- none: false
113
- requirements:
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ required_rubygems_version: !ruby/object:Gem::Requirement
104
+ requirements:
114
105
  - - ">="
115
- - !ruby/object:Gem::Version
116
- hash: 3
117
- segments:
118
- - 0
119
- version: "0"
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
120
108
  requirements: []
121
-
122
- rubyforge_project:
123
- rubygems_version: 1.8.24
109
+ rubygems_version: 3.2.4
124
110
  signing_key:
125
- specification_version: 3
111
+ specification_version: 4
126
112
  summary: Dassets engine for compiling Sass
127
- test_files:
113
+ test_files:
128
114
  - test/helper.rb
129
- - test/support/app/assets/from_sass.sass
130
- - test/support/app/assets/from_scss.scss
131
- - test/support/config/assets.rb
132
115
  - test/support/factory.rb
133
- - test/support/public/from_sass-7173fff1fe11e06f1339beceaf4a9857.css
134
- - test/support/public/from_scss-ffcdabded94a78022e9c92e06e311f69.css
135
- - test/system/digest_tests.rb
136
- - test/unit/engine_tests.rb
116
+ - test/system/.keep
117
+ - test/unit/dassets-sass_tests.rb
data/.gitignore DELETED
@@ -1,19 +0,0 @@
1
- *.gem
2
- *.log
3
- *.rbc
4
- .rbx/
5
- .bundle
6
- .config
7
- .yardoc
8
- Gemfile.lock
9
- InstalledFiles
10
- _yardoc
11
- coverage
12
- doc/
13
- lib/bundler/man
14
- pkg
15
- rdoc
16
- spec/reports
17
- test/tmp
18
- test/version_tmp
19
- tmp
data/Rakefile DELETED
@@ -1 +0,0 @@
1
- require "bundler/gem_tasks"
@@ -1,2 +0,0 @@
1
- table.hl
2
- margin: 2em 0
@@ -1,7 +0,0 @@
1
- $blue: #3bbfce;
2
- $margin: 16px;
3
- .border {
4
- padding: $margin / 2;
5
- margin: $margin / 2;
6
- border-color: $blue;
7
- }
@@ -1,11 +0,0 @@
1
- require 'dassets'
2
- require 'dassets-sass'
3
-
4
- Dassets.configure do |c|
5
- c.root_path File.expand_path("../..", __FILE__)
6
- c.engine 'scss', Dassets::Sass::Engine, :syntax => 'scss'
7
- c.engine 'sass', Dassets::Sass::Engine, :syntax => 'sass'
8
- c.cache = nil
9
- c.file_store 'public'
10
-
11
- end
@@ -1,2 +0,0 @@
1
- table.hl {
2
- margin: 2em 0; }
@@ -1,4 +0,0 @@
1
- .border {
2
- padding: 8px;
3
- margin: 8px;
4
- border-color: #3bbfce; }
@@ -1,52 +0,0 @@
1
- require 'assert'
2
- require 'fileutils'
3
- require 'dassets'
4
- require 'dassets-sass'
5
-
6
- module Dassets::Sass
7
-
8
- class DigestScssTests < Assert::Context
9
- desc "digesting a scss source file with the sass engine registered"
10
- setup do
11
- @source_file = File.join(Dassets.config.source_path, "from_scss.scss")
12
- File.open(@source_file, 'w'){ |f| f.write(@factory.scss) }
13
- @compiled_file = File.join(Dassets.config.root_path, "public/from_scss-ffcdabded94a78022e9c92e06e311f69.css")
14
- @exp_compiled_content = @factory.scss_compiled
15
-
16
- FileUtils.rm_f @compiled_file
17
- end
18
-
19
- should "produce a css file with the source scss compiled to css" do
20
- assert_file_exists @source_file
21
- assert_not_file_exists @compiled_file
22
- Dassets.digest_source_files
23
-
24
- assert_file_exists @compiled_file
25
- assert_equal @exp_compiled_content, File.read(@compiled_file)
26
- end
27
-
28
- end
29
-
30
- class DigestSassTests < Assert::Context
31
- desc "digesting a sass source file with the sass engine registered"
32
- setup do
33
- @source_file = File.join(Dassets.config.source_path, "from_sass.sass")
34
- File.open(@source_file, 'w'){ |f| f.write(@factory.sass) }
35
- @compiled_file = File.join(Dassets.config.root_path, "public/from_sass-7173fff1fe11e06f1339beceaf4a9857.css")
36
- @exp_compiled_content = @factory.sass_compiled
37
-
38
- FileUtils.rm_f @compiled_file
39
- end
40
-
41
- should "produce a css file with the source sass compiled to css" do
42
- assert_file_exists @source_file
43
- assert_not_file_exists @compiled_file
44
- Dassets.digest_source_files
45
-
46
- assert_file_exists @compiled_file
47
- assert_equal @exp_compiled_content, File.read(@compiled_file)
48
- end
49
-
50
- end
51
-
52
- end
@@ -1,46 +0,0 @@
1
- require 'assert'
2
- require 'dassets/engine'
3
- require 'dassets-sass'
4
-
5
- class Dassets::Sass::Engine
6
-
7
- class BaseTests < Assert::Context
8
- desc "the Dassets::Sass engine"
9
- setup do
10
- @engine = Dassets::Sass::Engine.new
11
- end
12
- subject{ @engine }
13
-
14
- should have_instance_method :syntax
15
-
16
- should "be a Dassets engine" do
17
- assert_kind_of Dassets::Engine, subject
18
- assert_respond_to 'ext', subject
19
- assert_respond_to 'compile', subject
20
- end
21
-
22
- should "default the syntax to `scss`" do
23
- assert_equal 'scss', Dassets::Sass::Engine.new.syntax
24
- end
25
-
26
- should "allow specifying the engine syntax using engine opts" do
27
- assert_equal 'sass', Dassets::Sass::Engine.new(:syntax => 'sass').syntax
28
- end
29
-
30
- should "transform any input extension to `css`" do
31
- assert_equal 'css', subject.ext('scss')
32
- assert_equal 'css', subject.ext('sass')
33
- assert_equal 'css', subject.ext('sassycss')
34
- assert_equal 'css', subject.ext('whatever')
35
- end
36
-
37
- should "compile any input content as Sass css" do
38
- assert_equal @factory.scss_compiled, subject.compile(@factory.scss)
39
-
40
- sass_engine = Dassets::Sass::Engine.new :syntax => 'sass'
41
- assert_equal @factory.sass_compiled, sass_engine.compile(@factory.sass)
42
- end
43
-
44
- end
45
-
46
- end