From 87ab0fbb8ae48e79778272d3d861c70b39fd3bf4 Mon Sep 17 00:00:00 2001 From: Ernesto Acevedo Date: Thu, 8 Oct 2015 12:36:59 -0300 Subject: [PATCH 01/27] Fix regex comparison for media queries --- lib/css_splitter/splitter.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/css_splitter/splitter.rb b/lib/css_splitter/splitter.rb index 1cf7a10..f5f6a25 100644 --- a/lib/css_splitter/splitter.rb +++ b/lib/css_splitter/splitter.rb @@ -18,7 +18,7 @@ def self.split_string_into_rules(css_string) in_media_query = false partial_rules.each do |rule| - if rule =~ /^@media/ + if rule =~ /^\s*@media/ in_media_query = true elsif bracket_balance == 0 in_media_query = false From bf64b9d6c192c06793864780fd8bc50c52ccbee7 Mon Sep 17 00:00:00 2001 From: Gareth Adams Date: Mon, 7 Dec 2015 22:26:54 +0000 Subject: [PATCH 02/27] Add a secret_key_base to the test app config Avoids a deprecation warning with Rails 4 --- test/dummy/config/secrets.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 test/dummy/config/secrets.yml diff --git a/test/dummy/config/secrets.yml b/test/dummy/config/secrets.yml new file mode 100644 index 0000000..7eb2e7e --- /dev/null +++ b/test/dummy/config/secrets.yml @@ -0,0 +1,2 @@ +test: + secret_key_base: c2a98602cc1537b2e38d4f279f20d24db66ff86fe523ab5197529f2ea907b6d70e2dca2fa3da50dcc9cad7bb1b861f0c45b6920fc576cc3e170d8c1ded61887f From 579cdca79370b1602b2e5ea43ef960309fc301b0 Mon Sep 17 00:00:00 2001 From: Gareth Adams Date: Tue, 8 Dec 2015 01:09:42 +0000 Subject: [PATCH 03/27] Allow debugger in test environment too --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 8a91985..866d014 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ source "http://rubygems.org" # development dependencies will be added by default to the :development group. gemspec -group :development do +group :development, :test do gem 'pry-byebug' end From 10ce82e23ccc95838e7d4c6b40df12ccb65f4cdf Mon Sep 17 00:00:00 2001 From: Gareth Adams Date: Tue, 8 Dec 2015 08:39:27 +0000 Subject: [PATCH 04/27] Add a test for media query with leading whitespace --- test/unit/splitter_test.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/unit/splitter_test.rb b/test/unit/splitter_test.rb index bcbb8e7..f9713ea 100644 --- a/test/unit/splitter_test.rb +++ b/test/unit/splitter_test.rb @@ -40,6 +40,11 @@ class CssSplitterTest < ActiveSupport::TestCase assert_equal ["a{foo:bar;}", "@media print{b{baz:qux;}", "c{quux:corge;}", "}", "d{grault:garply;}"], CssSplitter::Splitter.split_string_into_rules(has_media) end + test '#split_string_into_rules containing media queries with leading whitespace' do + has_media = "a{foo:bar;}\n @media print{b{baz:qux;}c{quux:corge;}}d{grault:garply;}" + assert_equal ["a{foo:bar;}", "\n @media print{b{baz:qux;}", "c{quux:corge;}", "}", "d{grault:garply;}"], CssSplitter::Splitter.split_string_into_rules(has_media) + end + test "#split_string_into_rules containing keyframes" do has_keyframes = "a{foo:bar;}@keyframes rubes{from{baz:qux;}50%{quux:corge;}}d{grault:garply;}" assert_equal ["a{foo:bar;}", "@keyframes rubes{from{baz:qux;}50%{quux:corge;}}", "d{grault:garply;}"], CssSplitter::Splitter.split_string_into_rules(has_keyframes) From c2a5b42714ace4d63ecd00fe6ca3742a25102360 Mon Sep 17 00:00:00 2001 From: Jakob Hilden Date: Fri, 11 Dec 2015 09:51:04 +0100 Subject: [PATCH 05/27] version 0.4.3 --- CHANGELOG.md | 4 ++++ lib/css_splitter/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9aff500..7c63865 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.4.3 + +* [bugfix] for media queries with whitespace in front of them #57 + # 0.4.2 * [bugfix] correctly split stylesheets even if @keyframes are directly on the rule limit #55 by [@rubenswieringa](https://github.com/rubenswieringa) diff --git a/lib/css_splitter/version.rb b/lib/css_splitter/version.rb index 22c192c..ae6eecc 100644 --- a/lib/css_splitter/version.rb +++ b/lib/css_splitter/version.rb @@ -1,3 +1,3 @@ module CssSplitter - VERSION = "0.4.2" + VERSION = "0.4.3" end From 4ffc2d4814c2b87d6641cd6787b0ebf0ccc8321d Mon Sep 17 00:00:00 2001 From: Jakob Hilden Date: Mon, 21 Dec 2015 10:26:57 +0100 Subject: [PATCH 06/27] limited maintenance mode --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 0a86631..c8348c9 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,11 @@ Gem for splitting up stylesheets that go beyond the IE limit of 4096 selectors, for Rails 3.1+ apps using the Asset Pipeline. You can read this [blogpost](http://railslove.com/blog/2013/03/08/overcoming-ies-4096-selector-limit-using-the-css-splitter-gem) for an explanation of this gem's background story. +### Development status + +Since the original developers of this gem are not actively using it in any project at the moment, it is currently in **limited maintenance** mode. Issues are read and pull requests will be reviewed and merged, but there is currently no acitve maintenance/development. + +If you are an active user of the gem and would able to help out maintaining it, it would be greatly appreciated. ## Installation From fb677509c97456bb5f7b4a2ce2f02b000faa490b Mon Sep 17 00:00:00 2001 From: Jakob Hilden Date: Mon, 21 Dec 2015 10:27:51 +0100 Subject: [PATCH 07/27] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c8348c9..77af792 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Gem for splitting up stylesheets that go beyond the IE limit of 4096 selectors, Since the original developers of this gem are not actively using it in any project at the moment, it is currently in **limited maintenance** mode. Issues are read and pull requests will be reviewed and merged, but there is currently no acitve maintenance/development. -If you are an active user of the gem and would able to help out maintaining it, it would be greatly appreciated. +If you are an active user of the gem and would be able to help out maintaining it, it would be greatly appreciated. Just look at the current issues/pull requests. ## Installation From 8b5e2025045e9a0009e5c1ff961036f0b7116a4d Mon Sep 17 00:00:00 2001 From: Keenan Brock Date: Wed, 23 Dec 2015 12:26:33 -0500 Subject: [PATCH 08/27] use recent ruby version --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f21f396..344b67b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,6 @@ +sudo: false language: ruby bundler_args: --without development rvm: - "1.9.3" - - "2.1.1" \ No newline at end of file + - "2.2" From c5e37a8141c628a9eaddb55bfce5b96cb615f191 Mon Sep 17 00:00:00 2001 From: Stephen Eckenrode Date: Mon, 28 Dec 2015 14:03:45 -0500 Subject: [PATCH 09/27] Gracefully handle when assets are not configured In sprockets-rails v3, app.assets is now only set when assets.compile is set to true. This is currently causing an error when upgrading to Rails 4.2.5. This change will cause CSS Splitter to only be registered when assets themselves are configured. Fixes #60 --- lib/css_splitter/engine.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/css_splitter/engine.rb b/lib/css_splitter/engine.rb index c51574e..335a5b1 100644 --- a/lib/css_splitter/engine.rb +++ b/lib/css_splitter/engine.rb @@ -3,7 +3,9 @@ class Engine < ::Rails::Engine isolate_namespace CssSplitter initializer 'css_splitter.sprockets_engine', after: 'sprockets.environment', group: :all do |app| - app.assets.register_bundle_processor 'text/css', CssSplitter::SprocketsEngine + app.config.assets.configure do |assets| + assets.register_bundle_processor 'text/css', CssSplitter::SprocketsEngine + end end initializer 'css_splitter.action_controller' do |app| From 632ee76ae907469455780d60d253b5b64f218695 Mon Sep 17 00:00:00 2001 From: Stephen Eckenrode Date: Mon, 28 Dec 2015 14:12:11 -0500 Subject: [PATCH 10/27] Upgrade bundler before running Travis tests --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f21f396..7ae037c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,4 +2,6 @@ language: ruby bundler_args: --without development rvm: - "1.9.3" - - "2.1.1" \ No newline at end of file + - "2.1.1" +before_install: + - gem update bundler From 9a813e780cfd10034b9ecd00f0f191ac903596e6 Mon Sep 17 00:00:00 2001 From: Jakob Hilden Date: Mon, 4 Jan 2016 15:05:10 +0100 Subject: [PATCH 11/27] installing byebug in test environment will break on travis + ruby 1.9.x --- Gemfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 866d014..8a91985 100644 --- a/Gemfile +++ b/Gemfile @@ -5,7 +5,7 @@ source "http://rubygems.org" # development dependencies will be added by default to the :development group. gemspec -group :development, :test do +group :development do gem 'pry-byebug' end From e10be4daaefde2bbde12145c93371af74e2e8820 Mon Sep 17 00:00:00 2001 From: Jakob Hilden Date: Mon, 4 Jan 2016 15:09:04 +0100 Subject: [PATCH 12/27] test against multiple rails versions --- .travis.yml | 2 ++ Gemfile | 8 -------- Gemfile.rails3 | 15 +++++++++++++++ 3 files changed, 17 insertions(+), 8 deletions(-) create mode 100644 Gemfile.rails3 diff --git a/.travis.yml b/.travis.yml index 2839d69..2f483a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,3 +5,5 @@ rvm: - "1.9.3" - "2.1.1" - "2.2" +gemfile: + - "Gemfile.rails3" \ No newline at end of file diff --git a/Gemfile b/Gemfile index 8a91985..74fab5c 100644 --- a/Gemfile +++ b/Gemfile @@ -13,11 +13,3 @@ gem "rails" gem "sass-rails" gem "jquery-rails" gem "uglifier" - -# Declare any dependencies that are still in development here instead of in -# your gemspec. These might include edge Rails or gems from your path or -# Git. Remember to move these dependencies to your gemspec before releasing -# your gem to rubygems.org. - -# To use debugger -# gem 'debugger' diff --git a/Gemfile.rails3 b/Gemfile.rails3 new file mode 100644 index 0000000..f511920 --- /dev/null +++ b/Gemfile.rails3 @@ -0,0 +1,15 @@ +source "http://rubygems.org" + +# Declare your gem's dependencies in css_splitter.gemspec. +# Bundler will treat runtime dependencies like base dependencies, and +# development dependencies will be added by default to the :development group. +gemspec + +group :development do + gem 'pry-byebug' +end + +gem "rails", '~> 3.1' +gem "sass-rails" +gem "jquery-rails" +gem "uglifier" From 01f3adf265a8de0545817266ffbe06f12fa44d89 Mon Sep 17 00:00:00 2001 From: Jakob Hilden Date: Mon, 4 Jan 2016 15:12:50 +0100 Subject: [PATCH 13/27] test both Gemfiles --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 2f483a7..eabf7de 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,7 +3,8 @@ language: ruby bundler_args: --without development rvm: - "1.9.3" - - "2.1.1" + - "2.1" - "2.2" gemfile: + - "Gemfile" - "Gemfile.rails3" \ No newline at end of file From b8bf7e8d1583591a08cbf115dfd9a58ca4398859 Mon Sep 17 00:00:00 2001 From: Jakob Hilden Date: Mon, 4 Jan 2016 15:21:41 +0100 Subject: [PATCH 14/27] don't install byebug for rails3 because travis is failing --- .gitignore | 1 + Gemfile.rails3 | 4 ---- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index a9ecfb8..8757807 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ .bundle/ Gemfile.lock +Gemfile.rails3.lock log/*.log pkg/ test/dummy/db/*.sqlite3 diff --git a/Gemfile.rails3 b/Gemfile.rails3 index f511920..a744df7 100644 --- a/Gemfile.rails3 +++ b/Gemfile.rails3 @@ -5,10 +5,6 @@ source "http://rubygems.org" # development dependencies will be added by default to the :development group. gemspec -group :development do - gem 'pry-byebug' -end - gem "rails", '~> 3.1' gem "sass-rails" gem "jquery-rails" From 5eee3181099ca2cfb824d9fa62cff8245b96ce63 Mon Sep 17 00:00:00 2001 From: Jakob Hilden Date: Mon, 4 Jan 2016 15:29:00 +0100 Subject: [PATCH 15/27] remove 2nd rails 3 gemfile again --- .gitignore | 1 - .travis.yml | 3 +-- Gemfile.rails3 | 11 ----------- 3 files changed, 1 insertion(+), 14 deletions(-) delete mode 100644 Gemfile.rails3 diff --git a/.gitignore b/.gitignore index 8757807..a9ecfb8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ .bundle/ Gemfile.lock -Gemfile.rails3.lock log/*.log pkg/ test/dummy/db/*.sqlite3 diff --git a/.travis.yml b/.travis.yml index eabf7de..f09ded4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,5 +6,4 @@ rvm: - "2.1" - "2.2" gemfile: - - "Gemfile" - - "Gemfile.rails3" \ No newline at end of file + - "Gemfile" \ No newline at end of file diff --git a/Gemfile.rails3 b/Gemfile.rails3 deleted file mode 100644 index a744df7..0000000 --- a/Gemfile.rails3 +++ /dev/null @@ -1,11 +0,0 @@ -source "http://rubygems.org" - -# Declare your gem's dependencies in css_splitter.gemspec. -# Bundler will treat runtime dependencies like base dependencies, and -# development dependencies will be added by default to the :development group. -gemspec - -gem "rails", '~> 3.1' -gem "sass-rails" -gem "jquery-rails" -gem "uglifier" From 0235df33c75e8154859fa40d4d0c1a816c44f36e Mon Sep 17 00:00:00 2001 From: Jakob Hilden Date: Mon, 4 Jan 2016 15:42:10 +0100 Subject: [PATCH 16/27] fix up dummy app --- test/dummy/config/initializers/assets.rb | 8 ++++++++ test/dummy/config/secrets.yml | 2 ++ 2 files changed, 10 insertions(+) create mode 100644 test/dummy/config/initializers/assets.rb diff --git a/test/dummy/config/initializers/assets.rb b/test/dummy/config/initializers/assets.rb new file mode 100644 index 0000000..b4de740 --- /dev/null +++ b/test/dummy/config/initializers/assets.rb @@ -0,0 +1,8 @@ +# Be sure to restart your server when you modify this file. + +# Version of your assets, change this if you want to expire all your assets. +Rails.application.config.assets.version = '1.0' + +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. +Rails.application.config.assets.precompile += %w( too_big_stylesheet.css too_big_stylesheet_split2.css ) \ No newline at end of file diff --git a/test/dummy/config/secrets.yml b/test/dummy/config/secrets.yml index 7eb2e7e..5dc368e 100644 --- a/test/dummy/config/secrets.yml +++ b/test/dummy/config/secrets.yml @@ -1,2 +1,4 @@ test: secret_key_base: c2a98602cc1537b2e38d4f279f20d24db66ff86fe523ab5197529f2ea907b6d70e2dca2fa3da50dcc9cad7bb1b861f0c45b6920fc576cc3e170d8c1ded61887f +development: + secret_key_base: c2a98602cc1537b2e38d4f279f20d24db66ff86fe523ab5197529f2ea907b6d70e2dca2fa3da50dcc9cad7bb1b861f0c45b6920fc576cc3e170d8c1ded61887f \ No newline at end of file From 3a953b285a3e03a02061e5072239f1756e4f15c0 Mon Sep 17 00:00:00 2001 From: Jakob Hilden Date: Mon, 4 Jan 2016 15:46:54 +0100 Subject: [PATCH 17/27] move some options in the config file --- test/dummy/config/application.rb | 3 --- test/dummy/config/environments/production.rb | 3 --- test/dummy/config/initializers/assets.rb | 2 +- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb index 6a0af91..4e42755 100644 --- a/test/dummy/config/application.rb +++ b/test/dummy/config/application.rb @@ -55,9 +55,6 @@ class Application < Rails::Application # Enable the asset pipeline config.assets.enabled = true - - # Version of your assets, change this if you want to expire all your assets - config.assets.version = '1.0' end end diff --git a/test/dummy/config/environments/production.rb b/test/dummy/config/environments/production.rb index 7ad11fe..d92c150 100644 --- a/test/dummy/config/environments/production.rb +++ b/test/dummy/config/environments/production.rb @@ -45,9 +45,6 @@ # Enable serving of images, stylesheets, and JavaScripts from an asset server # config.action_controller.asset_host = "http://assets.example.com" - # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added) - config.assets.precompile += %w( too_big_stylesheet.css too_big_stylesheet_split2.css test_stylesheet_with_media_queries.css test_stylesheet_with_media_queries_split2.css ) - # Disable delivery errors, bad email addresses will be ignored # config.action_mailer.raise_delivery_errors = false diff --git a/test/dummy/config/initializers/assets.rb b/test/dummy/config/initializers/assets.rb index b4de740..91073da 100644 --- a/test/dummy/config/initializers/assets.rb +++ b/test/dummy/config/initializers/assets.rb @@ -5,4 +5,4 @@ # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. -Rails.application.config.assets.precompile += %w( too_big_stylesheet.css too_big_stylesheet_split2.css ) \ No newline at end of file +Rails.application.config.assets.precompile += %w( too_big_stylesheet.css too_big_stylesheet_split2.css test_stylesheet_with_media_queries.css test_stylesheet_with_media_queries_split2.css ) \ No newline at end of file From c4b6e78e406a4c3145ac9265298c631471f3a4ff Mon Sep 17 00:00:00 2001 From: Jakob Hilden Date: Mon, 4 Jan 2016 15:50:00 +0100 Subject: [PATCH 18/27] bump version to 0.4.4 --- CHANGELOG.md | 4 ++++ lib/css_splitter/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c63865..bf1f58c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.4.4 + +* [bugfix] fix compatibility with with sprockts-rails version 3.x, see #62 + # 0.4.3 * [bugfix] for media queries with whitespace in front of them #57 diff --git a/lib/css_splitter/version.rb b/lib/css_splitter/version.rb index ae6eecc..06e4f4e 100644 --- a/lib/css_splitter/version.rb +++ b/lib/css_splitter/version.rb @@ -1,3 +1,3 @@ module CssSplitter - VERSION = "0.4.3" + VERSION = "0.4.4" end From 5e805e110b84e1b44a01e86832c44ac5b5ae1890 Mon Sep 17 00:00:00 2001 From: Scott Ringwelski Date: Thu, 21 Jan 2016 21:41:24 -0800 Subject: [PATCH 19/27] Fix issue with ActionController::API:Class Fix an issue where helper is not a defined method --- lib/css_splitter/engine.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/css_splitter/engine.rb b/lib/css_splitter/engine.rb index 335a5b1..4cdaba0 100644 --- a/lib/css_splitter/engine.rb +++ b/lib/css_splitter/engine.rb @@ -10,7 +10,8 @@ class Engine < ::Rails::Engine initializer 'css_splitter.action_controller' do |app| ActiveSupport.on_load :action_controller do - helper CssSplitter::ApplicationHelper + # Not all controllers use helpers (such as API based controllers) + helper CssSplitter::ApplicationHelper if respond_to?(:helper) end end end From 8ba82ab7918ee06a8f1e0ce4af406fd371831dce Mon Sep 17 00:00:00 2001 From: Brad Pardee Date: Mon, 4 Apr 2016 11:34:03 -0400 Subject: [PATCH 20/27] Remove isolate_namespace to fix unresolved split_stylesheet_link_tag --- lib/css_splitter/engine.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/css_splitter/engine.rb b/lib/css_splitter/engine.rb index 335a5b1..2f50392 100644 --- a/lib/css_splitter/engine.rb +++ b/lib/css_splitter/engine.rb @@ -1,7 +1,5 @@ module CssSplitter class Engine < ::Rails::Engine - isolate_namespace CssSplitter - initializer 'css_splitter.sprockets_engine', after: 'sprockets.environment', group: :all do |app| app.config.assets.configure do |assets| assets.register_bundle_processor 'text/css', CssSplitter::SprocketsEngine From 45cb5bcf460afd0ed4ded6570e1b6d2a470312a1 Mon Sep 17 00:00:00 2001 From: achernyshev Date: Thu, 14 Apr 2016 17:58:16 +0300 Subject: [PATCH 21/27] fix sprockets engine registering for older sprocket-rails versions --- lib/css_splitter/engine.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/css_splitter/engine.rb b/lib/css_splitter/engine.rb index 2f50392..17122f3 100644 --- a/lib/css_splitter/engine.rb +++ b/lib/css_splitter/engine.rb @@ -1,8 +1,12 @@ module CssSplitter class Engine < ::Rails::Engine initializer 'css_splitter.sprockets_engine', after: 'sprockets.environment', group: :all do |app| - app.config.assets.configure do |assets| - assets.register_bundle_processor 'text/css', CssSplitter::SprocketsEngine + if app.config.assets.public_methods.include? :configure + app.config.assets.configure do |assets| + assets.register_bundle_processor 'text/css', CssSplitter::SprocketsEngine + end + else + app.assets.register_bundle_processor 'text/css', CssSplitter::SprocketsEngine end end From 2a240553362fafa799f96b6bf6a5f343104df0df Mon Sep 17 00:00:00 2001 From: Jakob Hilden Date: Wed, 25 May 2016 11:19:33 +0200 Subject: [PATCH 22/27] version 0.4.5 --- CHANGELOG.md | 4 ++++ lib/css_splitter/version.rb | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf1f58c..44ba31a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.4.5 + +* [bugfix] fix sprockets engine registering for older sprocket-rails versions #68 + # 0.4.4 * [bugfix] fix compatibility with with sprockts-rails version 3.x, see #62 diff --git a/lib/css_splitter/version.rb b/lib/css_splitter/version.rb index 06e4f4e..c6d5586 100644 --- a/lib/css_splitter/version.rb +++ b/lib/css_splitter/version.rb @@ -1,3 +1,3 @@ module CssSplitter - VERSION = "0.4.4" + VERSION = "0.4.5" end From db0fe7575012e9650c271259e75eb299976ae9f1 Mon Sep 17 00:00:00 2001 From: Jakob Hilden Date: Wed, 1 Jun 2016 15:08:33 +0200 Subject: [PATCH 23/27] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 44ba31a..fc25e31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.4.6 (unreleased) + +* [bugfix] Fix issue where helper is not a defined method on controller (e.g. ActionController::API:Class) #65 + # 0.4.5 * [bugfix] fix sprockets engine registering for older sprocket-rails versions #68 From 24017c19c60739d2d1038e985687117839054150 Mon Sep 17 00:00:00 2001 From: Nick Donald Date: Mon, 22 Aug 2016 06:13:32 -0400 Subject: [PATCH 24/27] Follow sproket engine interface guidelines (#70) * Follow sproket engine interface guidelines * Clarify syntax, add comments --- lib/css_splitter/sprockets_engine.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/css_splitter/sprockets_engine.rb b/lib/css_splitter/sprockets_engine.rb index f6ae2a8..551af8c 100644 --- a/lib/css_splitter/sprockets_engine.rb +++ b/lib/css_splitter/sprockets_engine.rb @@ -10,6 +10,22 @@ def self.engine_initialized? def prepare end + def self.call(input) + data_in = input[:data] + + # Instantiate Sprockets::Context to pass along helper methods for Tilt + # processors + context = input[:environment].context_class.new(input) + + # Pass the asset file contents as a block to the template engine, + # then get the results of the engine rendering + engine = self.new { data_in } + rendered_data = engine.render(context, {}) + + # Return the data and any metadata (ie file dependencies, etc) + context.metadata.merge(data: rendered_data.to_str) + end + def evaluate(scope, locals, &block) # Evaluate the split if the asset is named with a trailing _split2, _split3, etc. if scope.logical_path =~ /_split(\d+)$/ From 5010809517f4ed4fc2379af1c2b2573b5ae8a3f2 Mon Sep 17 00:00:00 2001 From: Jakob Hilden Date: Sat, 27 Aug 2016 16:31:53 +0200 Subject: [PATCH 25/27] bump version to 0.4.6 --- CHANGELOG.md | 3 ++- lib/css_splitter/version.rb | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc25e31..cd411e3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ -# 0.4.6 (unreleased) +# 0.4.6 +* [fix] Implement new engine interface for future sprockets versions #70 * [bugfix] Fix issue where helper is not a defined method on controller (e.g. ActionController::API:Class) #65 # 0.4.5 diff --git a/lib/css_splitter/version.rb b/lib/css_splitter/version.rb index c6d5586..57859d1 100644 --- a/lib/css_splitter/version.rb +++ b/lib/css_splitter/version.rb @@ -1,3 +1,3 @@ module CssSplitter - VERSION = "0.4.5" + VERSION = "0.4.6" end From 749e5410ea67a585b65d75aefbd8c5a0bf1467fd Mon Sep 17 00:00:00 2001 From: khiav reoy Date: Sat, 22 Oct 2016 17:43:12 +0800 Subject: [PATCH 26/27] fix test in different gem version --- test/css_splitter_test.rb | 11 +++++------ test/dummy/config/application.rb | 3 ++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/css_splitter_test.rb b/test/css_splitter_test.rb index 5090a3d..012cf89 100644 --- a/test/css_splitter_test.rb +++ b/test/css_splitter_test.rb @@ -13,18 +13,17 @@ class CssSplitterTest < ActiveSupport::TestCase part2 = "#test{background-color:green}" * CssSplitter::Splitter::MAX_SELECTORS_DEFAULT part3 = "#test{background-color:blue}" - assert_equal "#{part1}#{part2}#{part3}\n", assets["erb_stylesheet"].to_s - assert_equal "#{part2}\n", assets["erb_stylesheet_split2"].to_s - assert_equal "#{part3}\n", assets["erb_stylesheet_split3"].to_s + assert_equal "#{part1}#{part2}#{part3}", assets["erb_stylesheet"].to_s.gsub(/\s/, '') + assert_equal "#{part2}", assets["erb_stylesheet_split2"].to_s.gsub(/\s/, '') + assert_equal "#{part3}", assets["erb_stylesheet_split3"].to_s.gsub(/\s/, '') end test "asset pipeline stylesheet splitting on stylesheet combined using requires" do red = "#test{background-color:red}" * 100 green = "#test{background-color:green}" * CssSplitter::Splitter::MAX_SELECTORS_DEFAULT blue = "#test{background-color:blue}" - - assert_equal "#{red}#{green}#{blue}\n", assets["combined"].to_s - assert_equal "#{"#test{background-color:green}" * 100}#{blue}\n", assets["combined_split2"].to_s + assert_equal "#{red}#{green}#{blue}", assets["combined"].to_s.gsub(/\s/, '') + assert_equal "#{"#test{background-color:green}" * 100}#{blue}", assets["combined_split2"].to_s.gsub(/\s/, '') end private diff --git a/test/dummy/config/application.rb b/test/dummy/config/application.rb index 4e42755..7a5b60e 100644 --- a/test/dummy/config/application.rb +++ b/test/dummy/config/application.rb @@ -38,7 +38,8 @@ class Application < Rails::Application # Configure sensitive parameters which will be filtered from the log file. config.filter_parameters += [:password] - + config.sass.line_comments = false + config.assets.compress = true # Enable escaping HTML in JSON. config.active_support.escape_html_entities_in_json = true From 6cc4244fdbe6599548bef790dc80c008dca1647e Mon Sep 17 00:00:00 2001 From: Christian Peters Date: Wed, 22 Feb 2023 13:36:45 +0100 Subject: [PATCH 27/27] Clarify that this gem is dead --- README.md | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 77af792..d1b3805 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,8 @@ Gem for splitting up stylesheets that go beyond the IE limit of 4096 selectors, ### Development status -Since the original developers of this gem are not actively using it in any project at the moment, it is currently in **limited maintenance** mode. Issues are read and pull requests will be reviewed and merged, but there is currently no acitve maintenance/development. - -If you are an active user of the gem and would be able to help out maintaining it, it would be greatly appreciated. Just look at the current issues/pull requests. +Fortunately, the problem of too large CSS files is long gone. This repo is unmaintained. +It remains as an artefact of dark times in the history of web browsers. ## Installation @@ -100,14 +99,13 @@ Since 0.4.1 in development split stylesheets have `debug: false` option by defau ## Credits & License -This is a joint project by the two German Rails shops [Zweitag](http://zweitag.de) and [Railslove](http://railslove.com), therefore the GitHub name "Zweilove". +This is a joint project by the two German Rails shops [Zweitag](https://zweitag.de) and [Railslove](https://railslove.com), therefore the GitHub name "Zweilove". -The original code was written by [Christian Peters](mailto:christian.peters@zweitag.de) and [Thomas Hollstegge](mailto:thomas.hollstegge@zweitag.de) (see this [Gist](https://gist.github.com/2398394)) and turned into a gem by [Jakob Hilden](mailto:jakobhilden@gmail.com). +The original code was written by Christian Peters and Thomas Hollstegge (see this [Gist](https://gist.github.com/2398394)) and turned into a gem by Jakob Hilden. **Major Contributors** * [@Umofomia](https://github.com/Umofomia) * [@kruszczynski](https://github.com/kruszczynski) -This project rocks and uses MIT-LICENSE. - +This project uses MIT-LICENSE.