metaskills / less-rails-bootstrap

The most popular front-end framework for developing responsive, mobile first projects on the web for Rails asset pipeline.
561 stars 127 forks source link

Cant reach my own variables or mixins #103

Closed adilsoncarvalho closed 10 years ago

adilsoncarvalho commented 10 years ago

As indicated on the documentation I've added the following lines on application.css

 *= require twitter/bootstrap
 *= require custom_bootstrap/custom_bootstrap

and added some variables on custom_bootstrap/variables.less and some mixins on custom_bootstrap/

But when I try to reach them on other .less files I always get the following error:

Showing /vagrant/site/app/views/layouts/application.html.erb where line #12 raised:

.rounded-corners is undefined
  (in /vagrant/site/app/assets/stylesheets/recipes.less)

Any idea of what am I missing?

P.S. - I've solved it including an import clause, but it does not seem to be the wright thing to do.

simi commented 10 years ago

Can you fork https://github.com/metaskills/less-rails-bootstrap-test and make changes to reproduce your problem please? It will speed up solving of this problem.

adilsoncarvalho commented 10 years ago

Yes I will. Thanks!

Cordialmente,

Adilson Carvalho


Ambiente para dev ruby (até em windows) ~~> http://bit.ly/1a38307

On Mon, Jan 20, 2014 at 9:59 PM, Josef Šimánek notifications@github.comwrote:

Can you fork https://github.com/metaskills/less-rails-bootstrap-test and make changes to reproduce your problem please? It will speed up solving of this problem.

— Reply to this email directly or view it on GitHubhttps://github.com/metaskills/less-rails-bootstrap/issues/103#issuecomment-32809188 .

adilsoncarvalho commented 10 years ago

Just to make it sure.

Shouldn't I get a compiled css when I get http://localhost:3000/assets/css/basic.css ?

It is just returning the raw contents of the file.

I've cloned the test repo, ran bundler install and then rails s

adilsoncarvalho commented 10 years ago

Got it.

The test project does not work under ruby 2.1. When I changed to ruby 1.9 it worked.

simi commented 10 years ago

So we're facing Ruby 2.1 issue?

adilsoncarvalho commented 10 years ago

So far it seems to be it. I changed back to 1.9 and I will write the same code I did on my project to see if it still not making my custom variables and mixing avaiable to my LESS.

If it works perfectly, I will downgrade to 1.9 on my real project to see if this makes a difference.

One thing on my real project is the gems versions. They are not the same as the ones on the test project.

simi commented 10 years ago

OK, I'll try less-rails-bootstrap with Ruby 2.1. Thanks for info.

simi commented 10 years ago

@adilsoncarvalho looks like Rails 3.1 issue only. Can you confirm? If not, please provide according informations.

adilsoncarvalho commented 10 years ago

I got stuck on my tests. I reset the environmente to test it again, and even on 1.9 it does not compile the CSS. I really don't know what is happening.

image

This is the gems I am using on ruby 1.9 and how I am running rails.

The process seems so easy? What am I doing wrong? Noob feelings :)

Any tips?

12:16:53 vagrant@dev : ~/apps/less-rails-bootstrap-test (master)
$ gem list

*** LOCAL GEMS ***

bigdecimal (1.1.0)
bundler (1.3.5)
bundler-unload (1.0.2)
executable-hooks (1.2.6)
gem-wrappers (1.2.4)
io-console (0.3)
json (1.5.5)
minitest (2.5.1)
rake (0.9.2.2)
rdoc (3.9.5)
rubygems-bundler (1.4.2)
rvm (1.11.3.8)

12:16:57 vagrant@dev : ~/apps/less-rails-bootstrap-test (master)
$ bundle install
Fetching gem metadata from http://rubygems.org/.........
Fetching gem metadata from http://rubygems.org/..
Using rake (0.9.2.2)
Installing i18n (0.6.0)
Installing multi_json (1.3.2)
Installing activesupport (3.2.2)
Installing builder (3.0.0)
Installing activemodel (3.2.2)
Installing erubis (2.7.0)
Installing journey (1.0.3)
Installing rack (1.4.1)
Installing rack-cache (1.2)
Installing rack-test (0.6.1)
Installing hike (1.2.1)
Installing tilt (1.3.3)
Installing sprockets (2.1.2)
Installing actionpack (3.2.2)
Installing mime-types (1.18)
Installing polyglot (0.3.3)
Installing treetop (1.4.10)
Installing mail (2.4.4)
Installing actionmailer (3.2.2)
Installing arel (3.0.2)
Installing tzinfo (0.3.33)
Installing activerecord (3.2.2)
Installing activeresource (3.2.2)
Installing coffee-script-source (1.3.1)
Installing execjs (1.3.0)
Installing coffee-script (2.2.0)
Installing rack-ssl (1.3.2)
Installing json (1.6.6)
Installing rdoc (3.12)
Installing thor (0.14.6)
Installing railties (3.2.2)
Installing coffee-rails (3.2.2)
Installing commonjs (0.2.6)
Installing jquery-rails (2.0.2)
Installing less (2.2.1)
Installing less-rails (2.2.2)
Installing less-rails-bootstrap (2.0.12)
Installing libv8 (3.3.10.4)
Using bundler (1.3.5)
Installing rails (3.2.2)
Installing sqlite3 (1.3.6)
Installing therubyracer (0.10.1)
Installing uglifier (1.2.4)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from multi_json:
********************************************************************************

  MultiJson.encode is deprecated and will be removed in the next major version.
  Use MultiJson.dump instead.

  MultiJson.decode is deprecated and will be removed in the next major version.
  Use MultiJson.load instead.

  MultiJson.engine is deprecated and will be removed in the next major version.
  Use MultiJson.adapter instead.

  MultiJson.engine= is deprecated and will be removed in the next major
  version. Use MultiJson.use instead.

  MultiJson.default_engine is deprecated and will be removed in the next major
  version. Use MultiJson.default_adapter instead.

********************************************************************************
Post-install message from rdoc:
Depending on your version of ruby, you may need to install ruby rdoc/ri data:

<= 1.8.6 : unsupported
= 1.8.7 : gem install rdoc-data; rdoc-data --install
= 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!

12:27:13 vagrant@dev : ~/apps/less-rails-bootstrap-test (master)
$ bundle exec rails s
=> Booting WEBrick
=> Rails 3.2.2 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2014-01-24 12:37:23] INFO  WEBrick 1.3.1
[2014-01-24 12:37:23] INFO  ruby 1.9.3 (2013-11-22) [x86_64-linux]
[2014-01-24 12:37:23] INFO  WEBrick::HTTPServer#start: pid=26514 port=3000

Started GET "/assets/full_control.css" for 10.0.2.2 at 2014-01-24 12:38:14 +0000
Served asset /full_control.css - 304 Not Modified (26ms)
[2014-01-24 12:38:15] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chu
nked = true
adilsoncarvalho commented 10 years ago

I read the Travis.CI log you sent.

The test project has the following gem versions (not compiling LESS at all), and in [] are the versions you used on your CI test.

Just upgraded less-rails-bootstrap to 3.0.6 what made the test project to have the same gems versions as on your CI test, except for rails (kept 3.2.2) and sprockets (goes to 2.1.3)

Same rails s and presto:

image

Then I used ruby 2.1 and followed the same process. It did not work. Then I changed to rails 4. It worked.

Result  Ruby  Rails  less-rails-bootstrap
failed  1.9   3.2.2  2.0.12
worked  1.9   3.2.2  3.0.6
failed  2.1   3.2.2  3.0.6
failed 2.1   4.0.2  3.0.6

On ruby 2.1 and rails 4.0.2 I got the following error:

01:46:14 vagrant@dev : ~/apps/less-rails-bootstrap-test (master)
$ bundle exec rails s
=> Booting WEBrick
=> Rails 3.2.16 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2014-01-24 13:47:04] INFO  WEBrick 1.3.1
[2014-01-24 13:47:04] INFO  ruby 2.1.0 (2013-12-25) [x86_64-linux]
[2014-01-24 13:47:04] INFO  WEBrick::HTTPServer#start: pid=30914 port=3000

Started GET "/assets/full_control.css" for 10.0.2.2 at 2014-01-24 13:48:43 +0000
Connecting to database specified by database.yml
Error compiling asset full_control.css:
Less::Error: 'twitter/bootstrap/reset.less' wasn't found
  (in /vagrant/less-rails-bootstrap-test/app/assets/stylesheets/full_control/index.css.less)
Served asset /full_control.css - 500 Internal Server Error

Interesting. Maybe this is why my app (running on ruby 2.1 and rails 4.0.2) can get the bootstrap css from the gem but can't reach the variables and mixins declared on custom_bootstrap/variables.less and custom_bootstrap/mixins.less to be avaiable to my the othe LESS files?

Hope this helped

adilsoncarvalho commented 10 years ago

On other project I've got this message when trying to compile the LESS styles

Showing /vagrant/m/myproject/app/views/layouts/application.html.erb where line #15 raised:

Unrecognised input
  (in /vagrant/m/myproject/app/assets/stylesheets/myproject/all.less)
Extracted source (around line #15):
12
13
14
15
16
17
18

     <link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet">
     <link href="//netdna.bootstrapcdn.com/font-awesome/4.0.0/css/font-awesome.css" rel="stylesheet">

     <%= stylesheet_link_tag    "application", media: "all", "data-turbolinks-track" => true %>
     <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
     <%= csrf_meta_tags %>

Rails.root: /vagrant/m/myproject

Application Trace | Framework Trace | Full Trace
less (2.4.0) lib/less/parser.rb:74:in `block (2 levels) in parse'
at finish (less (2.4.0) lib/less/js/lib/less/parser.js:475:21)
at tree.importVisitor.run (less (2.4.0) lib/less/js/lib/less/import-visitor.js:25:22)
at Parser.parser.parse (less (2.4.0) lib/less/js/lib/less/parser.js:484:22)
less (2.4.0) lib/less/parser.rb:64:in `block in parse'
less (2.4.0) lib/less/java_script/v8_context.rb:90:in `block in do_lock'
less (2.4.0) lib/less/java_script/v8_context.rb:88:in `call'
less (2.4.0) lib/less/java_script/v8_context.rb:88:in `Locker'
less (2.4.0) lib/less/java_script/v8_context.rb:88:in `do_lock'
less (2.4.0) lib/less/java_script/v8_context.rb:60:in `lock'
less (2.4.0) lib/less/java_script/v8_context.rb:30:in `exec'
less (2.4.0) lib/less/java_script.rb:26:in `exec'
less (2.4.0) lib/less/parser.rb:63:in `parse'
less-rails (2.4.2) lib/less/rails/template_handlers.rb:18:in `evaluate'
tilt (1.4.1) lib/tilt/template.rb:103:in `render'
sprockets (2.10.1) lib/sprockets/context.rb:197:in `block in evaluate'
sprockets (2.10.1) lib/sprockets/context.rb:194:in `each'
sprockets (2.10.1) lib/sprockets/context.rb:194:in `evaluate'
sprockets (2.10.1) lib/sprockets/processed_asset.rb:12:in `initialize'
sprockets (2.10.1) lib/sprockets/base.rb:374:in `new'
sprockets (2.10.1) lib/sprockets/base.rb:374:in `block in build_asset'
sprockets (2.10.1) lib/sprockets/base.rb:395:in `circular_call_protection'
sprockets (2.10.1) lib/sprockets/base.rb:373:in `build_asset'
sprockets (2.10.1) lib/sprockets/index.rb:94:in `block in build_asset'
sprockets (2.10.1) lib/sprockets/caching.rb:58:in `cache_asset'
sprockets (2.10.1) lib/sprockets/index.rb:93:in `build_asset'
sprockets (2.10.1) lib/sprockets/base.rb:287:in `find_asset'
sprockets (2.10.1) lib/sprockets/index.rb:61:in `find_asset'
sprockets (2.10.1) lib/sprockets/processed_asset.rb:111:in `block in resolve_dependencies'
sprockets (2.10.1) lib/sprockets/processed_asset.rb:105:in `each'
sprockets (2.10.1) lib/sprockets/processed_asset.rb:105:in `resolve_dependencies'
sprockets (2.10.1) lib/sprockets/processed_asset.rb:97:in `build_required_assets'
sprockets (2.10.1) lib/sprockets/processed_asset.rb:16:in `initialize'
sprockets (2.10.1) lib/sprockets/base.rb:374:in `new'
sprockets (2.10.1) lib/sprockets/base.rb:374:in `block in build_asset'
sprockets (2.10.1) lib/sprockets/base.rb:395:in `circular_call_protection'
sprockets (2.10.1) lib/sprockets/base.rb:373:in `build_asset'
sprockets (2.10.1) lib/sprockets/index.rb:94:in `block in build_asset'
sprockets (2.10.1) lib/sprockets/caching.rb:58:in `cache_asset'
sprockets (2.10.1) lib/sprockets/index.rb:93:in `build_asset'
sprockets (2.10.1) lib/sprockets/base.rb:287:in `find_asset'
sprockets (2.10.1) lib/sprockets/index.rb:61:in `find_asset'
sprockets (2.10.1) lib/sprockets/bundled_asset.rb:37:in `init_with'
sprockets (2.10.1) lib/sprockets/asset.rb:24:in `from_hash'
sprockets (2.10.1) lib/sprockets/caching.rb:54:in `cache_asset'
sprockets (2.10.1) lib/sprockets/index.rb:93:in `build_asset'
sprockets (2.10.1) lib/sprockets/base.rb:287:in `find_asset'
sprockets (2.10.1) lib/sprockets/index.rb:61:in `find_asset'
sprockets (2.10.1) lib/sprockets/environment.rb:75:in `find_asset'
sprockets (2.10.1) lib/sprockets/base.rb:295:in `[]'
sprockets-rails (2.0.1) lib/sprockets/rails/helper.rb:144:in `lookup_asset_for_path'
sprockets-rails (2.0.1) lib/sprockets/rails/helper.rb:113:in `block in stylesheet_link_tag'
sprockets-rails (2.0.1) lib/sprockets/rails/helper.rb:112:in `map'
sprockets-rails (2.0.1) lib/sprockets/rails/helper.rb:112:in `stylesheet_link_tag'
actionpack (4.0.2) lib/action_view/template.rb:143:in `block in render'
activesupport (4.0.2) lib/active_support/notifications.rb:161:in `instrument'
actionpack (4.0.2) lib/action_view/template.rb:141:in `render'
actionpack (4.0.2) lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
actionpack (4.0.2) lib/action_view/renderer/template_renderer.rb:47:in `render_template'
actionpack (4.0.2) lib/action_view/renderer/template_renderer.rb:17:in `render'
actionpack (4.0.2) lib/action_view/renderer/renderer.rb:42:in `render_template'
actionpack (4.0.2) lib/action_view/renderer/renderer.rb:23:in `render'
actionpack (4.0.2) lib/abstract_controller/rendering.rb:127:in `_render_template'
actionpack (4.0.2) lib/action_controller/metal/streaming.rb:219:in `_render_template'
actionpack (4.0.2) lib/abstract_controller/rendering.rb:120:in `render_to_body'
actionpack (4.0.2) lib/action_controller/metal/rendering.rb:33:in `render_to_body'
actionpack (4.0.2) lib/action_controller/metal/renderers.rb:26:in `render_to_body'
actionpack (4.0.2) lib/abstract_controller/rendering.rb:97:in `render'
actionpack (4.0.2) lib/action_controller/metal/rendering.rb:16:in `render'
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:41:in `block (2 levels) in render'
activesupport (4.0.2) lib/active_support/core_ext/benchmark.rb:12:in `block in ms'
/home/vagrant/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/benchmark.rb:294:in `realtime'
activesupport (4.0.2) lib/active_support/core_ext/benchmark.rb:12:in `ms'
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:41:in `block in render'
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:84:in `cleanup_view_runtime'
activerecord (4.0.2) lib/active_record/railties/controller_runtime.rb:25:in `cleanup_view_runtime'
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:40:in `render'
remotipart (1.2.1) lib/remotipart/render_overrides.rb:14:in `render_with_remotipart'
actionpack (4.0.2) lib/action_controller/metal/implicit_render.rb:10:in `default_render'
actionpack (4.0.2) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.0.2) lib/abstract_controller/base.rb:189:in `process_action'
actionpack (4.0.2) lib/action_controller/metal/rendering.rb:10:in `process_action'
actionpack (4.0.2) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (4.0.2) lib/active_support/callbacks.rb:403:in `_run__916400215820428595__process_action__callbacks'
activesupport (4.0.2) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.2) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (4.0.2) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
activesupport (4.0.2) lib/active_support/notifications.rb:159:in `block in instrument'
activesupport (4.0.2) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (4.0.2) lib/active_support/notifications.rb:159:in `instrument'
actionpack (4.0.2) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
actionpack (4.0.2) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
activerecord (4.0.2) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
actionpack (4.0.2) lib/abstract_controller/base.rb:136:in `process'
actionpack (4.0.2) lib/abstract_controller/rendering.rb:44:in `process'
actionpack (4.0.2) lib/action_controller/metal.rb:195:in `dispatch'
actionpack (4.0.2) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
actionpack (4.0.2) lib/action_controller/metal.rb:231:in `block in action'
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:80:in `call'
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:48:in `call'
actionpack (4.0.2) lib/action_dispatch/routing/mapper.rb:44:in `call'
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:71:in `block in call'
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:59:in `each'
actionpack (4.0.2) lib/action_dispatch/journey/router.rb:59:in `call'
actionpack (4.0.2) lib/action_dispatch/routing/route_set.rb:680:in `call'
omniauth (1.1.4) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.1.4) lib/omniauth/strategy.rb:164:in `call'
rack-pjax (0.7.0) lib/rack/pjax.rb:12:in `call'
warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
warden (1.2.3) lib/warden/manager.rb:34:in `catch'
warden (1.2.3) lib/warden/manager.rb:34:in `call'
rack (1.5.2) lib/rack/etag.rb:23:in `call'
rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
rack (1.5.2) lib/rack/head.rb:11:in `call'
remotipart (1.2.1) lib/remotipart/middleware.rb:27:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/flash.rb:241:in `call'
rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/cookies.rb:486:in `call'
activerecord (4.0.2) lib/active_record/query_cache.rb:36:in `call'
activerecord (4.0.2) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
activerecord (4.0.2) lib/active_record/migration.rb:369:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
activesupport (4.0.2) lib/active_support/callbacks.rb:373:in `_run__1538218999527048021__call__callbacks'
activesupport (4.0.2) lib/active_support/callbacks.rb:80:in `run_callbacks'
actionpack (4.0.2) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/reloader.rb:64:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
railties (4.0.2) lib/rails/rack/logger.rb:38:in `call_app'
railties (4.0.2) lib/rails/rack/logger.rb:20:in `block in call'
activesupport (4.0.2) lib/active_support/tagged_logging.rb:67:in `block in tagged'
activesupport (4.0.2) lib/active_support/tagged_logging.rb:25:in `tagged'
activesupport (4.0.2) lib/active_support/tagged_logging.rb:67:in `tagged'
railties (4.0.2) lib/rails/rack/logger.rb:20:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/request_id.rb:21:in `call'
rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
rack (1.5.2) lib/rack/runtime.rb:17:in `call'
activesupport (4.0.2) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
actionpack (4.0.2) lib/action_dispatch/middleware/static.rb:64:in `call'
rack (1.5.2) lib/rack/sendfile.rb:112:in `call'
railties (4.0.2) lib/rails/engine.rb:511:in `call'
railties (4.0.2) lib/rails/application.rb:97:in `call'
rack (1.5.2) lib/rack/lock.rb:17:in `call'
rack (1.5.2) lib/rack/content_length.rb:14:in `call'
rack (1.5.2) lib/rack/handler/webrick.rb:60:in `service'
/home/vagrant/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:138:in `service'
/home/vagrant/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/webrick/httpserver.rb:94:in `run'
/home/vagrant/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/webrick/server.rb:295:in `block in start_thread'
maxd commented 10 years ago

@adilsoncarvalho Have you resolved this issue?

maxd commented 10 years ago

Looks like discussion completed. I close it.