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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cc2d4d2e912a40049906bdd59ad44980b5339d6eb2e04a141ae9a657168ed38
4
- data.tar.gz: 8922f762b735a68d340c4794667930900d0182279f59094316cef6690b810510
3
+ metadata.gz: 23f5fe49ebc2e41737b3e0ba335d3d6e8e80881a0c8254eea4df38dac5d8f1fa
4
+ data.tar.gz: 5683c0766ae5173cf154fa9681cf5e3a9ddb695cfec71596560003cf80a6acd9
5
5
  SHA512:
6
- metadata.gz: 4b0066cc05354fb384a0375a4d683247957b49a9914ea4550536fbc75dbaf4f4b362a5f0de8861d71258d1485028170cda20db27e17c0a5a3a2c25652b8e5702
7
- data.tar.gz: 740d9640affe431606042f67ea75d014968befda50fc9fc39b1e07639cbaea4d206a316b202765b898469c36feed2b3ebb932a338ed2782ff230d9be7d9a5c0c
6
+ metadata.gz: 2b8eb042be8e5718507e33a641210237d0651490c96ba8662b0dd938b5df8384493ccbe62671fddb2693fdabbd78549fe8facb83005455e5d0010665fa5e4368
7
+ data.tar.gz: b8e1e66a17ab4eed47b68d69ac48b4c903475a41a673f62d1da4242713f1495b346d844be855bd72d774972982b7095c7b42674bdaea9e006b0c9ce163c5bc59
data/README.md CHANGED
@@ -1,9 +1,15 @@
1
1
  # PurgecssRails
2
- Short description and motivation.
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
- require "purgecss_rails"
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
- If you need more precision in purging the css, ex engines:
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
- ```ruby
52
- PurgecssRails.configure do |purge|
53
- purge.search_css_files("public/assets/my_engine/application.css")
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/my_engine/application.js",
56
- "engines/my_engine/views/**/*.html.erb",
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).
@@ -1,3 +1,3 @@
1
1
  module PurgecssRails
2
- VERSION = '0.5.0'
2
+ VERSION = '0.7.0'
3
3
  end
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.5.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 your css files considerably and improve your users experience
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://www.google.com
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: Use PurgeCSS with rails, designed for Asset Pipeline
76
+ summary: PurgeCSS wrapper which can be used with Rails Asset Pipeline
77
77
  test_files: []