Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

circular dependency thrown in version 0.4.4 during asset precompile from minimal Rails app #64

Open
johnkolen opened this issue Jan 8, 2016 · 5 comments

Comments

@johnkolen
Copy link

I'm trying to use css_splitter gem to break up the large combined CSS file for a Rails app. Unfortunately, something is not right as I'm running into the circular dependency issue regarding require_tree and require_self that should have disappeared post version 0.4.0. Any help is greatly appreciated.

Here's how to replicate the issue

  1. Created a fresh rails 4.1.6 app

  2. added to Gemfile
    gem 'css_splitter'

  3. added to application.css

    foo { width: 100; }

  4. created application_spilt2.css

    /*
    *= require 'application'
    */

  5. added to initializers/assets.rb
    Rails.application.config.assets.precompile += %w( application_split2.css )

$ rake assets:precompile
Sprockets::CircularDependencyError: /home/jkolen/Splitter/sp1/app/assets/stylesheets/application.css has already been required
/usr/local/rvm/gems/ruby-2.1.2@splitter_test/gems/sprockets-2.12.4/lib/sprockets/base.rb:392:in circular_call_protection' /usr/local/rvm/gems/ruby-2.1.2@splitter_test/gems/sprockets-2.12.4/lib/sprockets/base.rb:373:inbuild_asset'
....

I don't know if it's a red herring, but tracing through sprockets I noticed that the bundle option starts off true for application.css and then changes to false which leads to the thrown exception.

Here are the gem versions in the bundle:

Using rake 10.4.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.8.3
Using thread_safe 0.3.5
Using tzinfo 1.2.2
Using activesupport 4.1.6
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.6
Using rack 1.5.5
Using rack-test 0.6.3
Using actionpack 4.1.6
Using mime-types 2.99
Using mail 2.6.3
Using actionmailer 4.1.6
Using activemodel 4.1.6
Using arel 5.0.1.20140414130214
Using activerecord 4.1.6
Using coffee-script-source 1.10.0
Using execjs 2.6.0
Using coffee-script 2.4.1
Using thor 0.19.1
Using railties 4.1.6
Using coffee-rails 4.0.1
Using hike 1.2.3
Using multi_json 1.11.2
Using tilt 1.4.1
Using sprockets 2.12.4
Using css_splitter 0.4.4
Using jbuilder 2.4.0
Using jquery-rails 3.1.4
Using libv8 3.16.14.13
Using bundler 1.6.2
Using sprockets-rails 2.3.3
Using rails 4.1.6
Using rdoc 4.2.1
Using ref 2.0.0
Using sass 3.2.19
Using sass-rails 4.0.5
Using sdoc 0.4.1
Using spring 1.6.1
Using sqlite3 1.3.11
Using therubyracer 0.12.2
Using turbolinks 2.5.3
Using uglifier 2.7.2

@jhilden
Copy link
Contributor

jhilden commented Jan 11, 2016

Sorry, don't really have any idea. Anybody else?

@malcolm-pro
Copy link

malcolm-pro commented Apr 22, 2016

Getting the same problem. Do you think this could be related to your comment here?

@jhilden
Copy link
Contributor

jhilden commented Apr 24, 2016

it's possible. if you could provide a test app that demonstrates the problem I could take a look at it.

@malcolm-pro
Copy link

I went ahead and followed a suggestion to remove the 'require_tree .' and added 'require' statements for each file. A bit of a nuisance, but it worked.

@jhilden
Copy link
Contributor

jhilden commented Apr 27, 2016

thanks for the feedback @mmcfarland-cavulus

if you have other suggestions on how to improve it, please share them

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants