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

Assets conflict #557

Closed
paulitolinhares opened this issue Jan 11, 2017 · 8 comments
Closed

Assets conflict #557

paulitolinhares opened this issue Jan 11, 2017 · 8 comments

Comments

@paulitolinhares
Copy link

After I installed CamaleonCMS my asset pipeline broke and my app keeps giving me an error.

I tried to recompile the assets using bundle exec rake assets:precompile but it gives me the following error:

Sass::SyntaxError: Undefined mixin 'am-avatar'.
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/bundler/gems/active_material-c67d6854259b/app/assets/stylesheets/active_material/components/avatar.scss:2:in `am-avatar'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/bundler/gems/active_material-c67d6854259b/app/assets/stylesheets/active_material/components/avatar.scss:2
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/perform.rb:351:in `block in visit_mixin'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/stack.rb:98:in `block in with_mixin'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/stack.rb:115:in `with_frame'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/stack.rb:98:in `with_mixin'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/perform.rb:349:in `visit_mixin'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/base.rb:36:in `visit'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/perform.rb:160:in `block in visit'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/stack.rb:79:in `block in with_base'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/stack.rb:115:in `with_frame'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/stack.rb:79:in `with_base'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/perform.rb:160:in `visit'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/perform.rb:433:in `block (2 levels) in visit_rule'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/perform.rb:433:in `map'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/perform.rb:433:in `block in visit_rule'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/perform.rb:181:in `with_environment'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/perform.rb:431:in `visit_rule'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/base.rb:36:in `visit'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/perform.rb:160:in `block in visit'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/stack.rb:79:in `block in with_base'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/stack.rb:115:in `with_frame'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/stack.rb:79:in `with_base'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/perform.rb:160:in `visit'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/base.rb:52:in `block in visit_children'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/base.rb:52:in `map'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/base.rb:52:in `visit_children'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/perform.rb:169:in `block in visit_children'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/perform.rb:181:in `with_environment'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/perform.rb:168:in `visit_children'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/base.rb:36:in `block in visit'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/perform.rb:188:in `visit_root'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/base.rb:36:in `visit'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/perform.rb:159:in `visit'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/visitors/perform.rb:8:in `visit'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/root_node.rb:36:in `css_tree'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/tree/root_node.rb:20:in `render'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-3.4.22/lib/sass/engine.rb:281:in `render'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sass-rails-5.0.6/lib/sass/rails/template.rb:47:in `evaluate'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/tilt-2.0.5/lib/tilt/template.rb:102:in `render'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/legacy_tilt_processor.rb:25:in `call'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:75:in `call_processor'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:56:in `call_processors'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/loader.rb:60:in `block in load'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/loader.rb:44:in `load'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:47:in `load'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/bundle.rb:23:in `block in call'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/utils.rb:196:in `dfs'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/bundle.rb:24:in `call'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:75:in `call_processor'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:56:in `reverse_each'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/processor_utils.rb:56:in `call_processors'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/loader.rb:134:in `load_from_unloaded'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/loader.rb:60:in `block in load'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/loader.rb:44:in `load'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:20:in `block in initialize'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/cached_environment.rb:47:in `load'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/base.rb:66:in `find_asset'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/base.rb:73:in `find_all_linked_assets'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:142:in `block in find'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:209:in `each'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:209:in `stat_directory'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:227:in `stat_tree'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:231:in `block in stat_tree'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:209:in `each'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:209:in `stat_directory'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:227:in `stat_tree'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:231:in `block in stat_tree'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:209:in `each'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:209:in `stat_directory'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/path_utils.rb:227:in `stat_tree'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:105:in `each'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:105:in `block in logical_paths'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:104:in `each'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/legacy.rb:104:in `logical_paths'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:140:in `find'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/sprockets/manifest.rb:185:in `compile'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-3.7.0/lib/rake/sprocketstask.rb:147:in `with_logger'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/sprockets-rails-3.2.0/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/task.rb:248:in `block in execute'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/task.rb:243:in `each'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/task.rb:243:in `execute'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/task.rb:187:in `block in invoke_with_call_chain'
/Users/paulitolinhares/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/task.rb:180:in `invoke_with_call_chain'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/task.rb:173:in `invoke'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:152:in `invoke_task'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:108:in `each'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:108:in `block in top_level'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:117:in `run_with_threads'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:102:in `top_level'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:80:in `block in run'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:178:in `standard_exception_handling'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:77:in `run'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/bin/rake:22:in `load'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/bin/rake:22:in `<main>'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
/Users/paulitolinhares/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => assets:precompile

Apparently after I installed the gem messed up how my assets are organized on my app.

Below is my application.css

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
 * files in this directory. Styles in this file should be added after the last require_* statement.
 * It is generally better to create a new file per style scope.
 *
 *= require_tree .
 *= require_self
 */

and here is the only file I have on the folder: active_admin.scss

// SASS variable overrides must be declared before loading up Active Admin's styles.
//
// To view the variables that Active Admin provides, take a look at
// `app/assets/stylesheets/active_admin/mixins/_variables.scss` in the
// Active Admin source.
//
// For example, to change the sidebar width:
// $sidebar-width: 242px;

// Active Admin's got SASS!
@import "active_admin/mixins";
@import "active_material";

// Overriding any non-variable SASS must be done after the fact.
// For example, to change the default status-tag color:
//
//   .status_tag { background: #6090DB; }

The line @import "active_admin/mixins"; is the one that is supposed to import the mixin, but after I installed Camaleon it stopped working.

@owen2345
Copy link
Owner

Hi @paulitolinhares
it is because Camaleon is trying to precompile your file, please add a prefix _ to skip the precompiling.
sample:
_my_function.sass
Sorry for the inconvenience but this will be fixed in the next version....

@paulitolinhares
Copy link
Author

Hi @owen2345, I tried to adapt your fix but the same kind of error happens.

I'm attaching my folder structure below

alt text

(all the files below components have _ before its name too)

Also below is my only file that doesn't have an _ before its name is application.scss now, which the contents are below:

/* Variables Loaded */
@import "variables";
/* Helpers */
@import "helpers/*";
/* Bootstrap */
@import "bootstrap-sprockets";
@import "bootstrap";
/* Common Styles */
@import "shared";
/* Components */
@import "components/*";
/* Utilities */
@import "utilities/*";

And I keep getting an Undefined variable error on my sass precompilation that didn't happen before installing the gem. Do you have any other suggestions?

@paulitolinhares
Copy link
Author

Just to add to the comment above: I managed to make it work importing the _variables.scss file again on my _shared.scss file, which was the one that was having errors. It seems this problem only happens on files that are on the app/assets/stylesheets folder, since I have other files on the subfolders that use the variables and none of them had errors. Also, I removed the activeadmin theme gem that was causing the error that started this issue in order to make it work.

When I added the gem back, the error kept happening even though I added the _ to the active_admin.scss file

@owen2345
Copy link
Owner

owen2345 commented Jan 17, 2017

@paulitolinhares
I added an improvement for precompilation, please test using git version.

@NySiya
Copy link

NySiya commented Jan 20, 2017

I am having the same issues. Not only custom variable even Bootstrap Sass variable and Bourbon Mixin also undefined. The structure of my asset is
screen shot 2017-01-20 at 2 42 45 pm
And This how I have imported
screen shot 2017-01-20 at 2 44 41 pm

and This is how I used the variable:
screen shot 2017-01-20 at 2 47 51 pm

And When I rails s or do a rake assets:precompile it give me this error:
screen shot 2017-01-20 at 2 46 24 pm

Even I trying to used Camaleon CMS git version, it still the same.

Kind Regards

@owen2345
Copy link
Owner

can someone create a repository with the problem to see/work the problem?
Regards,

@NySiya
Copy link

NySiya commented Mar 13, 2017

Hello @owen2345

Please, checkout this repo for the problem. The problem has happened not only variable is undefined but also mixin. For the first time, when I run rails s, it worked fine, but after I restart server for several times, it gave me that errors.

Kind Regards,

@owen2345
Copy link
Owner

owen2345 commented Mar 18, 2017

Solved!
#579 (comment)

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

4 participants