csscompress 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -0
- data/lib/csscompress/sprockets.rb +16 -7
- data/lib/csscompress/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75ef7574672df524b20274f7deaef47683eec4558c713edd6cba223129c59491
|
4
|
+
data.tar.gz: 80872153f6e622744f79cf486f457e9c3494f9ad7865d4fb76648a14f2a21ff3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a22d517a045815343b28f56cf1e70db023c49d2e2b252436771616f035a9b3a6e24402e893f98d55e723d42eba51d63158a7b9d06432c1bf9eb12ad6efd5240
|
7
|
+
data.tar.gz: 645cac386629b8ac62d56919d60e6056c5fac1344ea7aa1f815211bc88aaf4b0e365bb27ee67ad6b8e23b8a941a9a8310fc052fc97cb51c9a0fc6a63f24b4c9f
|
data/README.md
CHANGED
@@ -25,6 +25,14 @@ require "csscompress"
|
|
25
25
|
minified_css_string = Csscompress.minify("/path/to/css/file")
|
26
26
|
```
|
27
27
|
|
28
|
+
### Rails with Sprockets / Asset Pipeline
|
29
|
+
|
30
|
+
In `config/environments/production.rb` and `config/environments/test.rb`:
|
31
|
+
|
32
|
+
```rb
|
33
|
+
config.assets.css_compressor = :csscompress
|
34
|
+
```
|
35
|
+
|
28
36
|
## Contributing
|
29
37
|
|
30
38
|
Bug reports and pull requests are welcome on GitHub at https://github.com/domchristie/csscompress. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/domchristie/csscompress/blob/main/CODE_OF_CONDUCT.md).
|
@@ -1,10 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
{
|
1
|
+
class CsscompressCompressor
|
2
|
+
VERSION = 1
|
3
|
+
|
4
|
+
def self.cache_key
|
5
|
+
"#{name}:#{Csscompress::VERSION}:#{VERSION}".freeze
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.call(input)
|
9
|
+
puts "[#{name}] Compressing…"
|
10
|
+
Tempfile.create([input[:name], ".css"]) do |file|
|
11
|
+
file << input[:data]
|
12
|
+
file.close
|
13
|
+
{data: Csscompress.minify(file.path)}
|
14
|
+
end
|
6
15
|
end
|
7
|
-
|
16
|
+
end
|
8
17
|
|
9
18
|
begin
|
10
19
|
require "sprockets"
|
@@ -13,5 +22,5 @@ rescue LoadError
|
|
13
22
|
end
|
14
23
|
|
15
24
|
if defined?(Sprockets)
|
16
|
-
Sprockets.register_compressor "text/css", :csscompress,
|
25
|
+
Sprockets.register_compressor "text/css", :csscompress, CsscompressCompressor
|
17
26
|
end
|
data/lib/csscompress/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: csscompress
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dom Christie
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-01-
|
11
|
+
date: 2022-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: execjs
|