purgecss_rails 0.5.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +50 -31
- data/lib/purgecss_rails/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23f5fe49ebc2e41737b3e0ba335d3d6e8e80881a0c8254eea4df38dac5d8f1fa
|
4
|
+
data.tar.gz: 5683c0766ae5173cf154fa9681cf5e3a9ddb695cfec71596560003cf80a6acd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b8eb042be8e5718507e33a641210237d0651490c96ba8662b0dd938b5df8384493ccbe62671fddb2693fdabbd78549fe8facb83005455e5d0010665fa5e4368
|
7
|
+
data.tar.gz: b8e1e66a17ab4eed47b68d69ac48b4c903475a41a673f62d1da4242713f1495b346d844be855bd72d774972982b7095c7b42674bdaea9e006b0c9ce163c5bc59
|
data/README.md
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
# PurgecssRails
|
2
|
-
|
3
|
-
|
4
|
-
## Usage
|
2
|
+
Reduce the bloat in your Rails CSS files using PurgeCSS. You can easily configure it to work with most rails apps.
|
5
3
|
|
6
4
|
## Installation
|
5
|
+
|
6
|
+
First you would need a `purgecss` executable.
|
7
|
+
you can easily add by:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
yarn add purgecss
|
11
|
+
```
|
12
|
+
|
7
13
|
Add this line to your application's Gemfile:
|
8
14
|
|
9
15
|
```ruby
|
@@ -20,44 +26,47 @@ Or install it yourself as:
|
|
20
26
|
$ gem install purgecss_rails
|
21
27
|
```
|
22
28
|
|
29
|
+
## Usage
|
30
|
+
|
23
31
|
Define a file lib/tasks/purge_css.rake and put:
|
24
32
|
|
25
33
|
```ruby
|
26
|
-
|
27
|
-
|
28
|
-
desc "PurgeCSS"
|
29
|
-
namespace :purge_css do
|
30
|
-
task :clear do
|
31
|
-
`rm public/assets/*.css -rf`
|
32
|
-
`rm public/assets/*.css.gz -rf`
|
33
|
-
end
|
34
|
-
|
35
|
-
task :run do
|
36
|
-
PurgecssRails.configure do |purge|
|
37
|
-
purge.search_css_files("public/assets/**/*.css")
|
38
|
-
|
39
|
-
purge.match_html_files "public/assets/**/*.js",
|
40
|
-
"app/views/**/*.html.erb",
|
41
|
-
"app/helpers/**/*.rb"
|
42
|
-
|
43
|
-
purge.optimize!
|
44
|
-
end.enable!.run_now!
|
45
|
-
end
|
46
|
-
end
|
47
|
-
```
|
34
|
+
require "purgecss_rails"
|
48
35
|
|
49
|
-
|
36
|
+
namespace :purge_css do
|
37
|
+
desc "Clear previous CSS files, this busts the CSS cache"
|
38
|
+
task :clear do
|
39
|
+
`rm public/assets/*.css -rf`
|
40
|
+
`rm public/assets/*.css.gz -rf`
|
41
|
+
end
|
50
42
|
|
51
|
-
|
52
|
-
|
53
|
-
|
43
|
+
desc "Optimize css files with PurgeCSS"
|
44
|
+
task :run do
|
45
|
+
PurgecssRails.configure(purge_css_path: "node_modules/purgecss/bin/purgecss") do |purge|
|
46
|
+
purge.search_css_files("public/assets/**/*.css")
|
54
47
|
|
55
|
-
purge.match_html_files "public/assets
|
56
|
-
"
|
48
|
+
purge.match_html_files "public/assets/**/*.js",
|
49
|
+
"app/views/**/*.html.erb",
|
57
50
|
"app/helpers/**/*.rb"
|
58
51
|
|
59
52
|
purge.optimize!
|
60
53
|
end.enable!.run_now!
|
54
|
+
end
|
55
|
+
end
|
56
|
+
```
|
57
|
+
|
58
|
+
If you need more precision in purging the css, ex engines:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
PurgecssRails.configure(purge_css_path: `purgecss`) do |purge|
|
62
|
+
purge.search_css_files("public/assets/my_engine/application.css")
|
63
|
+
|
64
|
+
purge.match_html_files "public/assets/my_engine/application.js",
|
65
|
+
"engines/my_engine/views/**/*.html.erb",
|
66
|
+
"app/helpers/**/*.rb"
|
67
|
+
|
68
|
+
purge.optimize!
|
69
|
+
end.enable!.run_now!
|
61
70
|
```
|
62
71
|
|
63
72
|
When you are using an external engine and you don't want to purge their css file, add a ingore
|
@@ -68,5 +77,15 @@ When you are using an external engine and you don't want to purge their css file
|
|
68
77
|
|
69
78
|
you can also call `purge.refresh!` and reuse the the `purge` object
|
70
79
|
|
80
|
+
## Deployment
|
81
|
+
|
82
|
+
Heroku Procfile example
|
83
|
+
|
84
|
+
`release: rake purge_css:clear assets:precompile purge_css:run`
|
85
|
+
|
86
|
+
Other
|
87
|
+
|
88
|
+
`rake purge_css:clear assets:precompile purge_css:run`
|
89
|
+
|
71
90
|
## License
|
72
91
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: purgecss_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sebi
|
@@ -38,7 +38,7 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
description: Reduce
|
41
|
+
description: Reduce the bloat in your Rails CSS files
|
42
42
|
email:
|
43
43
|
- gore.sebyx@yahoo.com
|
44
44
|
executables: []
|
@@ -51,7 +51,7 @@ files:
|
|
51
51
|
- lib/purgecss_rails.rb
|
52
52
|
- lib/purgecss_rails/builder.rb
|
53
53
|
- lib/purgecss_rails/version.rb
|
54
|
-
homepage: https://
|
54
|
+
homepage: https://github.com/sebyx07/purgecss_rails
|
55
55
|
licenses:
|
56
56
|
- MIT
|
57
57
|
metadata: {}
|
@@ -73,5 +73,5 @@ requirements: []
|
|
73
73
|
rubygems_version: 3.0.3
|
74
74
|
signing_key:
|
75
75
|
specification_version: 4
|
76
|
-
summary:
|
76
|
+
summary: PurgeCSS wrapper which can be used with Rails Asset Pipeline
|
77
77
|
test_files: []
|