-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from jwilsjustin/6-register-custom-compressor-i…
…n-railtie register custom compressor in railtie
- Loading branch information
Showing
9 changed files
with
171 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
nodejs 20.9.0 | ||
ruby 3.2.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,15 @@ | ||
## [Unreleased] | ||
## [1.0.0] - 2023-12-21 | ||
|
||
## [0.1.0] - 2022-07-22 | ||
- v1.0.0 🎉 | ||
- Now you can specify your css compression with a symbol | ||
```ruby | ||
config.assets.css_compressor = :escompress | ||
``` | ||
|
||
## [0.3.0] - 2022-12-22 | ||
|
||
## [0.2.0] - 2022-12-22 | ||
|
||
## [0.1.0] - 2022-07-29 | ||
|
||
- Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,21 @@ | ||
require "rails/railtie" | ||
|
||
module Escompress | ||
class Railtie < Rails::Railtie | ||
initializer "escompress_railtie.configure_rails_initialization" do | ||
class Railtie < ::Rails::Railtie | ||
initializer "escompress_railtie.configure_rails_initialization", group: :all do | ||
Escompress.esbuild_executable = Rails.root.join("node_modules/esbuild/bin/esbuild") | ||
|
||
# Adapted from https://github.com/ahorek/terser-ruby/blob/46a23ba/lib/terser/railtie.rb | ||
if config.respond_to?(:assets) # Ensure asset pipeline is there | ||
config.assets.configure do |env| | ||
# A processor is expected to respond to call() and it accepts a hash of file contents. | ||
# It is expected to return a hash that includes a :data key. | ||
# https://github.com/rails/sprockets/blob/main/guides/extending_sprockets.md#compressors | ||
# https://github.com/rails/sprockets/blob/main/guides/extending_sprockets.md#extension-interface | ||
env.register_compressor "text/css", :escompress, Escompress::Compressor.new(loader: :css) | ||
env.register_compressor "application/javascript", :escompress, Escompress::Compressor.new(loader: :js) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Escompress | ||
VERSION = "0.3.0" | ||
VERSION = "1.0.0" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters