forgecrafted / ruby-stylus Goto Github PK
View Code? Open in Web Editor NEW(DEPRECATED) Ruby interface for Stylus
License: MIT License
(DEPRECATED) Ruby interface for Stylus
License: MIT License
I have disabled the asset pipeline (due to the fact that I have my own asset framework) and cannot get stylus to work with Rails 3.1.3
I've added gem 'stylus'
to my Gemfile and then did a bundle install
. Now I cannot boot the application:
=> Booting WEBrick
=> Rails 3.1.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/activesupport-3.1.3/lib/active_support/whiny_nil.rb:48:in `method_missing': undefined method `register_engine' for nil:NilClass (NoMethodError)
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/stylus-0.4.0/lib/stylus/railtie.rb:13:in `block in <class:Railtie>'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/railties-3.1.3/lib/rails/initializable.rb:30:in `run'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/railties-3.1.3/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `each'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/railties-3.1.3/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/railties-3.1.3/lib/rails/application.rb:96:in `initialize!'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/railties-3.1.3/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/homebass/apps/fineprint/config/environment.rb:5:in `<top (required)>'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `block in require'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `block in load_dependency'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:640:in `new_constants_in'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:223:in `load_dependency'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require'
from /Users/homebass/apps/fineprint/config.ru:4:in `block in <main>'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/rack-1.3.6/lib/rack/builder.rb:51:in `instance_eval'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/rack-1.3.6/lib/rack/builder.rb:51:in `initialize'
from /Users/homebass/apps/fineprint/config.ru:1:in `new'
from /Users/homebass/apps/fineprint/config.ru:1:in `<main>'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/rack-1.3.6/lib/rack/builder.rb:40:in `eval'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/rack-1.3.6/lib/rack/builder.rb:40:in `parse_file'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/rack-1.3.6/lib/rack/server.rb:200:in `app'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/railties-3.1.3/lib/rails/commands/server.rb:46:in `app'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/rack-1.3.6/lib/rack/server.rb:301:in `wrapped_app'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/rack-1.3.6/lib/rack/server.rb:252:in `start'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/railties-3.1.3/lib/rails/commands/server.rb:70:in `start'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/railties-3.1.3/lib/rails/commands.rb:54:in `block in <top (required)>'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/railties-3.1.3/lib/rails/commands.rb:49:in `tap'
from /Users/homebass/.rvm/gems/ruby-1.9.3-p0@fp/gems/railties-3.1.3/lib/rails/commands.rb:49:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
Hi,
I have an
application.css.styl
and a
_general.styl
partial. If I do changes in the partial they won't change my application.css until I change the application.styl aswell. I guess it's hard to detect indirect file changes. A workaround would be if you detect a partial to be changed that you invalidate all css.
Best
Sebastian
Hello. I'm trying to use dookie-css with ruby-stylus
and trying to connect it with my rails app in an stylus.rb
:
require 'stylus'
if defined? Stylus
Stylus.use :nib
Stylus.use "dookie-css"
Stylus.debug = Rails.env != "production"
end
And when I @import "dookie-css"
in my styles I get an error TypeError: object is not a function
. I guess this is because there is a need to call dookie.css()
function to add it to stylus, but I don't know how to do it in my initializer.
Hello Lucas,
Just a question, i'm using this gem for first time in rails assets
Got an initializer with following code :
Stylus.use(:nib) unless Rails.env == 'production'
and got this in a styl
file
@import "nib"
but got the following error
ActionView::Template::Error (Error: Cannot find module 'nib'
what's wrong in the call of nib
?
thank you
https://github.com/railsjedi/ruby-stylus/commit/4a8d1d4136cc9fae9cc8a56fc9d234c1428f0f20
otherwise app.assets will be nil
Currently, this gem tests works for Rails+Sprockets, but not for Sinatra/any rack app + Sprockets. That's mostly because the Sprocket registration module is Rails-dependent and only loaded in Rails. However, there should be a way to register the engine if Sprockets is present but not Rails.
It would be nice to use the import method to make nib (for example) available on all stylesheets. I tried doing
Stylus.import :nib
, but that didn't work. Example of import with node:
return stylus(str)
.set('filename', path)
.set('compress', true)
.use(nib())
.import('nib');
something along the lines of:
if defined? Slim
module Slim
class EmbeddedEngine
register :styl,
TagEngine, tag: :style, attributes: { type: 'text/css' },
engine: StaticTiltEngine
end
end
end
would add a styl
embedded engine to slim so that the contents would pass through stylus:
head
styl:
body
font-family san-serif
body
hello
I've had to include this line in my config/application.rb file to get this to work with bundler.
Bundler.require *Rails.groups(:assets => %w(development test))
I always forget and then waste time racking my brain as to how I did that invariably trying require 'stylus' to strange results and then referring to the http://guides.rubyonrails.org/asset_pipeline.htmlhttp://guides.rubyonrails.org/asset_pipeline.html over and over until I read this.
I am trying to deploy to heroku, but on the assets:compile task I get the following error:
Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
Error: Cannot find module 'stylus'
(in /tmp/build_32efnae5pk6od/app/assets/stylesheets/application.styl)
How can I tell heroku to install "Stylus"
On localhost it works perfectly.
I'm using Rails 3.1, and I've got some CSS files that each include a common partial. This common partial needs to reference image assets (using the image_path
method, for instance). Is there a way to do this?
If I append .erb
to my _partial.styl
file, Stylus complains the partial cannot be found. If I instead name the file _partial.styl.css.erb
, the @import "_partial.css"
directive is treated as a CSS import and not a Stylus import. There doesn't seem to be any way to get asset filenames into a partial. :(
At least tilt is missing; haven't checked for others.
$ cat > Gemfile
source :rubygems
gem "stylus"
^D$ bundle
Using multi_json (1.5.0)
Using execjs (1.4.0)
Using stylus-source (0.31.0)
Using stylus (0.6.2)
Using bundler (1.2.1)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
$ cat > test.rb
require "stylus"
^D$ bundle exec ruby test.rb
/home/caleb/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/stylus-0.6.2/lib/stylus/tilt.rb:1:in `require': cannot load such file -- tilt (LoadError)
...
I've a quick question, why you didn't use ExecJS::Runtimes.best_available
?
For example we are forced to use node.js when I choose to use therubyracer.
We should package up the stylus source code into its own gem (stylus-source).
CoffeeScript gem does it pretty well
https://github.com/josh/ruby-coffee-script/blob/master/coffee-script.gemspec
undefined method `split' for nil:NilClass
(in /Volumes/Secondary/Users/eric/Projects/airkrft/synergy/development/synergy_development/app/assets/stylesheets/base.css.styl)
2: <html>
3: <head>
4: <title>SynergyDevelopment</title>
5: <%= stylesheet_link_tag "application" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: </head>
.bundle/ruby/1.9.1/bundler/gems/execjs-121e97dbf45c/lib/execjs/external_runtime.rb:166:in `exec_runtime'
.bundle/ruby/1.9.1/bundler/gems/execjs-121e97dbf45c/lib/execjs/external_runtime.rb:28:in `block in exec'
.bundle/ruby/1.9.1/bundler/gems/execjs-121e97dbf45c/lib/execjs/external_runtime.rb:41:in `compile_to_tempfile'
.bundle/ruby/1.9.1/bundler/gems/execjs-121e97dbf45c/lib/execjs/external_runtime.rb:27:in `exec'
.bundle/ruby/1.9.1/bundler/gems/execjs-121e97dbf45c/lib/execjs/external_runtime.rb:19:in `eval'
.bundle/ruby/1.9.1/bundler/gems/execjs-121e97dbf45c/lib/execjs/external_runtime.rb:33:in `call'
.bundle/ruby/1.9.1/bundler/gems/ruby-stylus-0e6dacd7f8bc/lib/stylus.rb:106:in `compile'
.bundle/ruby/1.9.1/bundler/gems/ruby-stylus-0e6dacd7f8bc/lib/stylus/tilt.rb:25:in `evaluate'
.bundle/ruby/1.9.1/gems/tilt-1.3.3/lib/tilt/template.rb:76:in `render'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/context.rb:177:in `block in evaluate'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/context.rb:174:in `each'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/context.rb:174:in `evaluate'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/processed_asset.rb:12:in `initialize'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:241:in `new'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:241:in `block in build_asset'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:262:in `circular_call_protection'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:240:in `build_asset'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/index.rb:89:in `block in build_asset'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/caching.rb:19:in `cache_asset'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/index.rb:88:in `build_asset'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:163:in `find_asset'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/index.rb:56:in `find_asset'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/processed_asset.rb:106:in `block in build_required_assets'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/processed_asset.rb:100:in `each'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/processed_asset.rb:100:in `build_required_assets'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/processed_asset.rb:16:in `initialize'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:241:in `new'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:241:in `block in build_asset'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:262:in `circular_call_protection'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:240:in `build_asset'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/index.rb:89:in `block in build_asset'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/caching.rb:19:in `cache_asset'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/index.rb:88:in `build_asset'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:163:in `find_asset'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/index.rb:56:in `find_asset'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/bundled_asset.rb:38:in `init_with'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/asset.rb:24:in `from_hash'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/caching.rb:15:in `cache_asset'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/index.rb:88:in `build_asset'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:163:in `find_asset'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/index.rb:56:in `find_asset'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/environment.rb:74:in `find_asset'
.bundle/ruby/1.9.1/gems/sprockets-2.1.3/lib/sprockets/base.rb:171:in `[]'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/sprockets/helpers/rails_helper.rb:126:in `asset_for'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/sprockets/helpers/rails_helper.rb:44:in `block in stylesheet_link_tag'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/sprockets/helpers/rails_helper.rb:43:in `collect'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/sprockets/helpers/rails_helper.rb:43:in `stylesheet_link_tag'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_view/template.rb:143:in `block in render'
.bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/notifications.rb:125:in `instrument'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_view/template.rb:141:in `render'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_view/renderer/template_renderer.rb:54:in `render_with_layout'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_view/renderer/template_renderer.rb:40:in `render_template'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_view/renderer/template_renderer.rb:13:in `render'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_view/renderer/renderer.rb:36:in `render_template'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_view/renderer/renderer.rb:17:in `render'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/abstract_controller/rendering.rb:109:in `_render_template'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_controller/metal/streaming.rb:225:in `_render_template'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/abstract_controller/rendering.rb:103:in `render_to_body'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_controller/metal/renderers.rb:28:in `render_to_body'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_controller/metal/compatibility.rb:50:in `render_to_body'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/abstract_controller/rendering.rb:88:in `render'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_controller/metal/rendering.rb:16:in `render'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_controller/metal/instrumentation.rb:40:in `block (2 levels) in render'
.bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/core_ext/benchmark.rb:5:in `block in ms'
/Volumes/Secondary/Users/eric/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
.bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/core_ext/benchmark.rb:5:in `ms'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_controller/metal/instrumentation.rb:40:in `block in render'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_controller/metal/instrumentation.rb:83:in `cleanup_view_runtime'
.bundle/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/railties/controller_runtime.rb:24:in `cleanup_view_runtime'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_controller/metal/instrumentation.rb:39:in `render'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_controller/metal/implicit_render.rb:10:in `default_render'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_controller/metal/implicit_render.rb:5:in `send_action'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/abstract_controller/base.rb:167:in `process_action'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_controller/metal/rendering.rb:10:in `process_action'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
.bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:414:in `_run__366715727028907439__process_action__1567012959472233528__callbacks'
.bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:405:in `__run_callback'
.bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
.bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:81:in `run_callbacks'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/abstract_controller/callbacks.rb:17:in `process_action'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_controller/metal/rescue.rb:29:in `process_action'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
.bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/notifications.rb:123:in `block in instrument'
.bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
.bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/notifications.rb:123:in `instrument'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_controller/metal/params_wrapper.rb:205:in `process_action'
.bundle/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/abstract_controller/base.rb:121:in `process'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/abstract_controller/rendering.rb:45:in `process'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_controller/metal.rb:203:in `dispatch'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_controller/metal.rb:246:in `block in action'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/routing/route_set.rb:67:in `call'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/routing/route_set.rb:67:in `dispatch'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/routing/route_set.rb:30:in `call'
.bundle/ruby/1.9.1/gems/journey-1.0.3/lib/journey/router.rb:68:in `block in call'
.bundle/ruby/1.9.1/gems/journey-1.0.3/lib/journey/router.rb:56:in `each'
.bundle/ruby/1.9.1/gems/journey-1.0.3/lib/journey/router.rb:56:in `call'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/routing/route_set.rb:594:in `call'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
.bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/etag.rb:23:in `call'
.bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/conditionalget.rb:25:in `call'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/middleware/head.rb:14:in `call'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/middleware/flash.rb:242:in `call'
.bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:205:in `context'
.bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/session/abstract/id.rb:200:in `call'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/middleware/cookies.rb:338:in `call'
.bundle/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/query_cache.rb:64:in `call'
.bundle/ruby/1.9.1/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:443:in `call'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
.bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:405:in `_run__4584780968770532352__call__3997917159744560292__callbacks'
.bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:405:in `__run_callback'
.bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
.bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:81:in `run_callbacks'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/middleware/reloader.rb:65:in `call'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
.bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/rack/logger.rb:26:in `call_app'
.bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/rack/logger.rb:16:in `call'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/middleware/request_id.rb:22:in `call'
.bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/methodoverride.rb:21:in `call'
.bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/runtime.rb:17:in `call'
.bundle/ruby/1.9.1/gems/activesupport-3.2.2/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
.bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/lock.rb:15:in `call'
.bundle/ruby/1.9.1/gems/actionpack-3.2.2/lib/action_dispatch/middleware/static.rb:61:in `call'
.bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/engine.rb:479:in `call'
.bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/application.rb:220:in `call'
.bundle/ruby/1.9.1/gems/railties-3.2.2/lib/rails/railtie/configurable.rb:30:in `method_missing'
/Volumes/Secondary/Users/eric/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:146:in `handle'
/Volumes/Secondary/Users/eric/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:99:in `rescue in block (2 levels) in start'
/Volumes/Secondary/Users/eric/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:96:in `block (2 levels) in start'
/Volumes/Secondary/Users/eric/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:86:in `each'
/Volumes/Secondary/Users/eric/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:86:in `block in start'
/Volumes/Secondary/Users/eric/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:66:in `loop'
/Volumes/Secondary/Users/eric/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:66:in `start'
/Volumes/Secondary/Users/eric/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/lib/nack/server.rb:13:in `run'
/Volumes/Secondary/Users/eric/Library/Application Support/Pow/Versions/0.3.2/node_modules/nack/bin/nack_worker:4:in `<main>'
Hi there, I have a stock Rail 3.1 dummy app running on Windows 7 64bit, So I added
gem "stylus"
to my Gemfile and bundle install turned out fine.
so for a simple test, I just created a test.css.styl in the app/assets/stylesheet
and include it in some page
<%= stylesheet_link_tag "test" %>
When the server tries to load that file, it halts and opens up some sort of debug file likely generated by execjs like this:
(function(program, execJS, module, exports, require) { execJS(program) })(function() { var stylus = require('stylus');
function compiler(str, options, plugins) {
var style = stylus(str, options);
var output = '';
for(var name in plugins) {
var fn = require(name);
style.use(fn(plugins[name]));
}
style.render(function(error, css) {
if(error) throw error;
output = css;
})
return output;
}
function convert(str) {
return stylus.convertCSS(str);
}
function version() {
return stylus.version;
}
return eval("(compiler.apply(this, ["body\n background-color #fff\n color #333\n",{"compress":false,"paths":["c:/r/cafe/app/assets/images","c:/r/cafe/app/assets/javascripts","c:/r/cafe/app/assets/panda_uploader","c:/r/cafe/app/assets/stylesheets","C:/Ruby192/lib/ruby/gems/1.9.1/gems/jquery-rails-1.0.11/vendor/assets/javascripts"]},{}]))")
}, function(program) {
var output, print = function(string) {
process.stdout.write('' + string);
};
try {
result = program();
if (typeof result == 'undefined' && result !== null) {
print('["ok"]');
} else {
try {
print(JSON.stringify(['ok', result]));
} catch (err) {
print('["err"]');
}
}
} catch (err) {
print(JSON.stringify(['err', '' + err]));
}
});
i really can't figure out this output all by myself, if I have go guess, I think it says that execjs cannot find a parser for stylus? If that's the case, what do I have to do extra to get that to work?
Thanks
When including in the application.css
/*
*= require_self
*= require globals
*/
Getting exception
couldn't find file 'globals'
globals.css.styl
exists in the same application.css
directory
Alternatively,
When including in the application.css
/*
*= require_self
* require_tree .
*/
The development server is trying to include globals.css.stylus.css and gets a 404.
Any ideas?
Fairly important feature for me -- I would love to take a stab at this, but my understanding of the internals here is definitely limited. Is this a feature anyone has thought about or has any tips or pushes in the right direction for?
Hi, I'm trying to test the Stylus language in a clean rails app and I get the error every time I request the css that should be generated by Stylus:
You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.split
(in /Users/tycooon/code/example/app/assets/stylesheets/application.css.styl)
My Gemfile:
source 'http://rubygems.org'
gem 'rails', '3.1.3'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3'
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'coffee-rails'
gem 'uglifier'
gem 'stylus'
end
gem 'jquery-rails'
The error trace:
execjs (1.2.13) lib/execjs/external_runtime.rb:146:in `exec_runtime'
execjs (1.2.13) lib/execjs/external_runtime.rb:27:in `block in exec'
execjs (1.2.13) lib/execjs/external_runtime.rb:40:in `compile_to_tempfile'
execjs (1.2.13) lib/execjs/external_runtime.rb:26:in `exec'
execjs (1.2.13) lib/execjs/external_runtime.rb:18:in `eval'
execjs (1.2.13) lib/execjs/external_runtime.rb:32:in `call'
stylus (0.4.0) lib/stylus.rb:106:in `compile'
stylus (0.4.0) lib/stylus/tilt.rb:25:in `evaluate'
tilt (1.3.3) lib/tilt/template.rb:76:in `render'
sprockets (2.0.3) lib/sprockets/context.rb:175:in `block in evaluate'
sprockets (2.0.3) lib/sprockets/context.rb:172:in `each'
sprockets (2.0.3) lib/sprockets/context.rb:172:in `evaluate'
sprockets (2.0.3) lib/sprockets/bundled_asset.rb:171:in `build_dependency_context_and_body'
sprockets (2.0.3) lib/sprockets/bundled_asset.rb:135:in `dependency_context'
sprockets (2.0.3) lib/sprockets/bundled_asset.rb:194:in `build_dependencies_paths_and_assets'
...
This happens even when I directly request assets/test.css
from by browser (with app/assets/test.css.styl
is empty or has some simple rule)
or its 3.1 only?
I figured it's time to track this from a comment in PR #38.
I'd really like this feature as I'm stuck on rails 3.2 in my app at the moment.
I've attempted a few times to backport myself but my understanding of Sprockets and the Asset pipeline to unfortunately too limited. Especially the difference between 3.2 and 4.0.
I have not used stylus, but thought you may like to see how I made the less-rails gem make all @import
'ed files an automatic dependency. It was really easy with a simple sprockets preprocessor. Here is mine.
https://github.com/metaskills/less-rails/blob/master/lib/less/rails/import_processor.rb
In my initializer, I do something like this.
app.assets.register_preprocessor 'text/css', ImportProcessor
rake assets:precompile works fine locally but on heroku application.css.styl doesn't get caught by the precompiler. and even if I turn on the development environment where it doesn't depend on precompiled assets, you still don't see it. it's like the stylus gem just doesn't exist on heroku.
Currently, plugins do not work on Windows due to the UNIX path separators used in NODE_PATH
in lib/stylus.rb
. Pull request incoming.
I've upgraded my 3.2.12 Rails app to ruby 2.0.0-p0 and ever since, ruby-stylus has ceased to work. Has anybody else had success with Ruby 2?
Edit: I just downgraded to ruby 1.9.3 and I can confirm that it seems to be an issue with the new ruby.
Given the following scenario:
If I want "tenant.styl.erb" to pull in "ria.css" from the "resources" directory, I should just be able to do "@import ria.css". Unfortunately, it seems like ruby-stylus doesn't take responsibility for all the @imports to build out the asset chain.
If my project found in "/public/external-project-submodule" isn't rails-specific, it shouldn't have to use sprockets specific comments. It should be able to use regular CSS and define relative @import statements. Ruby-stylus should traverse all the includes and resolve them as it is effectively the CSS interpreter during a build.
The real problem here is that I've added a path to sprockets and @imports aren't working the way they should.
Everything runs fine on my local machine, but when I try to deploy to Heroku I get the following error during asset precompilation. This is on Rails 4.0.2.
Error: Cannot find module '../package'
(in /tmp/build_81a7667a-4210-463b-93c3-82c1ed995a4a/app/assets/stylesheets/buttons.styl)
stylus
tries to be kind and avoid hard dependencies on sprockets
and tilt
, but it tries to load the related code if they are defined. Since this is getting out of hand, maybe explicit requires made the applications should avoid the chance of these loading issues, so.
stylus
will just require the Stylus
module;stylus/tilt
/ tilt/stylus
to load the templates;stylus/sprockets
to load the .setup
method definition;stylus/railtie
for the Railtie.Should not be a problem to test it.
Workaround:
elm {
display: unquote("block !important")
}
I have a master file importing a setup file. The setup file then imports a set of module files.
If I edit the module files, nothing compiles. But altering the setup or the master files runs the compiler correctly.
I'm probably missing something small in my setup but I'm struggling to get the gem to work in rails 4. I'm simply getting a 404 for any .css.styl file in the asset pipeline. The file gets included in the manifest when I precompile but it hasn't been processed by stylus in anyway. The individual files get included in development but are 404'd.
I've included the gem as normal. And I've also included it straight from github trying the master branch and the rails_4 branch same results with each so I don't think it's a problem with the gem per say but maybe an extra config step I missed..?
Any help would be appreciated.
on my latest push to heroku:
Running: rake assets:precompile
I, [2013-08-07T00:33:36.998984 #16277] INFO -- : Writing /tmp/build_1altue0ld8dx3/public/assets/application-47ed396c05865bfcfba7e7fe1f92065c.js
rake aborted!
Error: Cannot find module '../package'
(in /tmp/build_1altue0ld8dx3/app/assets/stylesheets/application.css.styl)
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:68:in `extract_result'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:28:in `block in exec'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:41:in `compile_to_tempfile'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:27:in `exec'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:19:in `eval'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:33:in `call'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/stylus-1.0.0.beta/lib/stylus/runtime.rb:17:in `exec'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/stylus-1.0.0.beta/lib/stylus.rb:106:in `compile'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/stylus-1.0.0.beta/lib/stylus/tilt.rb:49:in `evaluate'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/context.rb:197:in `block in evaluate'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/context.rb:194:in `each'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/context.rb:194:in `evaluate'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/processed_asset.rb:12:in `initialize'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/base.rb:374:in `new'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/base.rb:374:in `block in build_asset'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/base.rb:395:in `circular_call_protection'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/base.rb:373:in `build_asset'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/index.rb:94:in `block in build_asset'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/caching.rb:58:in `cache_asset'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/index.rb:93:in `build_asset'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/base.rb:287:in `find_asset'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/index.rb:61:in `find_asset'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/bundled_asset.rb:16:in `initialize'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/base.rb:377:in `new'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/base.rb:377:in `build_asset'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/index.rb:94:in `block in build_asset'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/caching.rb:58:in `cache_asset'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/index.rb:93:in `build_asset'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/base.rb:287:in `find_asset'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/index.rb:61:in `find_asset'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:211:in `block in find_asset'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:257:in `benchmark'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:210:in `find_asset'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:119:in `block in compile'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:118:in `each'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/sprockets/manifest.rb:118:in `compile'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.0/lib/sprockets/rails/task.rb:60:in `block (3 levels) in define'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-2.10.0/lib/rake/sprocketstask.rb:146:in `with_logger'
/tmp/build_1altue0ld8dx3/vendor/bundle/ruby/2.0.0/gems/sprockets-rails-2.0.0/lib/sprockets/rails/task.rb:59:in `block (2 levels) in define'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)
!
! Precompiling assets failed.
!
! Push rejected, failed to compile Ruby/Rails app
any ideas?
If you're thrown an error such as
The 'sys' module is now called 'util'. It should have a similar interface.
upon starting your server here are the files in the stylus package that need editing:
Just swap 'util' where 'sys' is currently.
./node_modules/stylus/lib/parser.js:
13 , nodes = require('./nodes')
14 , Token = require('./token')
15: , inspect = require('sys').inspect
16 , errors = require('./errors');
17
./node_modules/stylus/lib/token.js:
10 */
11
12: var inspect = require('sys').inspect;
13
14 /**
./node_modules/stylus/node_modules/growl/test.js:
14 growl.notify('Show pdf filesystem icon', { image: 'article.pdf' })
15 growl.notify('Show pdf filesystem icon', { image: 'article.pdf' }, function(){
16: require('sys').p('callback')
17 })
I tried, and here is what I got:
PS C:\Sites\Proj> rails s
Could not find gem 'ruby-stylus (>= 0) x86-mingw32' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.
PS C:\Sites\Proj> bundle install
Fetching source index for https://rubygems.org/
Could not find gem 'ruby-stylus (>= 0) x86-mingw32' in any of the gem sources listed in your Gemfile.
PS C:\Sites\Proj> bundle install
Fetching https://github.com/lucasmazza/ruby-stylus.git
remote: Counting objects: 934, done.
remote: Compressing objects: 100% (418/418), done.
d 856 (dReeclteia vi4ng 57object)s: 35% (327/934)
Receiving objects: 100% (934/934), 99.26 KiB, done.
Resolving deltas: 100% (532/532), done.
Fetching source index for https://rubygems.org/
Could not find gem 'ruby-stylus (>= 0) x86-mingw32' in https://github.com/lucasmazza/ruby-stylus.git (at master).
Source does not contain any versions of 'ruby-stylus (>= 0) x86-mingw32'
PS C:\Sites\Proj> rails s
https://github.com/lucasmazza/ruby-stylus.git (at master) is not checked out. Please run `bundle install`
Or did I do something wrong?
This is an error from running on rails:
I'm assuming this is an error from execjs running stylus, but I'm not sure:
Arguments to path.join must be strings
(in app/assets/stylesheets/custom.css.styl)
Extracted source (around line 17):
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
Full stack trace(ommitted past sprockets):
execjs (2.0.2) lib/execjs/external_runtime.rb:68:in `extract_result'
execjs (2.0.2) lib/execjs/external_runtime.rb:28:in `block in exec'
execjs (2.0.2) lib/execjs/external_runtime.rb:41:in `compile_to_tempfile'
execjs (2.0.2) lib/execjs/external_runtime.rb:27:in `exec'
execjs (2.0.2) lib/execjs/external_runtime.rb:19:in `eval'
execjs (2.0.2) lib/execjs/external_runtime.rb:33:in `call'
stylus (1.0.1) lib/stylus/runtime.rb:16:in `exec'
stylus (1.0.1) lib/stylus.rb:106:in `compile'
stylus (1.0.1) lib/stylus/tilt/stylus.rb:47:in `evaluate'
stylus (1.0.1) lib/stylus/tilt/rails.rb:13:in `evaluate'
tilt (1.4.1) lib/tilt/template.rb:103:in `render'
sprockets (2.11.0) lib/sprockets/context.rb:197:in `block in evaluate'
sprockets (2.11.0) lib/sprockets/context.rb:194:in `each'
sprockets (2.11.0) lib/sprockets/context.rb:194:in `evaluate'
sprockets (2.11.0) lib/sprockets/processed_asset.rb:12:in `initialize'
sprockets (2.11.0) lib/sprockets/base.rb:374:in `new'
sprockets (2.11.0) lib/sprockets/base.rb:374:in `block in build_asset'
sprockets (2.11.0) lib/sprockets/base.rb:395:in `circular_call_protection'
sprockets (2.11.0) lib/sprockets/base.rb:373:in `build_asset'
sprockets (2.11.0) lib/sprockets/index.rb:94:in `block in build_asset'
sprockets (2.11.0) lib/sprockets/caching.rb:58:in `cache_asset'
sprockets (2.11.0) lib/sprockets/index.rb:93:in `build_asset'
sprockets (2.11.0) lib/sprockets/base.rb:287:in `find_asset'
sprockets (2.11.0) lib/sprockets/index.rb:61:in `find_asset'
sprockets (2.11.0) lib/sprockets/processed_asset.rb:111:in `block in resolve_dependencies'
sprockets (2.11.0) lib/sprockets/processed_asset.rb:105:in `each'
sprockets (2.11.0) lib/sprockets/processed_asset.rb:105:in `resolve_dependencies'
sprockets (2.11.0) lib/sprockets/processed_asset.rb:97:in `build_required_assets'
sprockets (2.11.0) lib/sprockets/processed_asset.rb:16:in `initialize'
sprockets (2.11.0) lib/sprockets/base.rb:374:in `new'
sprockets (2.11.0) lib/sprockets/base.rb:374:in `block in build_asset'
sprockets (2.11.0) lib/sprockets/base.rb:395:in `circular_call_protection'
sprockets (2.11.0) lib/sprockets/base.rb:373:in `build_asset'
sprockets (2.11.0) lib/sprockets/index.rb:94:in `block in build_asset'
sprockets (2.11.0) lib/sprockets/caching.rb:58:in `cache_asset'
sprockets (2.11.0) lib/sprockets/index.rb:93:in `build_asset'
sprockets (2.11.0) lib/sprockets/base.rb:287:in `find_asset'
sprockets (2.11.0) lib/sprockets/index.rb:61:in `find_asset'
sprockets (2.11.0) lib/sprockets/bundled_asset.rb:37:in `init_with'
sprockets (2.11.0) lib/sprockets/asset.rb:24:in `from_hash'
sprockets (2.11.0) lib/sprockets/caching.rb:54:in `cache_asset'
sprockets (2.11.0) lib/sprockets/index.rb:93:in `build_asset'
sprockets (2.11.0) lib/sprockets/base.rb:287:in `find_asset'
sprockets (2.11.0) lib/sprockets/index.rb:61:in `find_asset'
sprockets (2.11.0) lib/sprockets/environment.rb:75:in `find_asset'
sprockets (2.11.0) lib/sprockets/base.rb:295:in `[]'
Any ideas? I'm baffled.
couldn’t find file 'nib'
Stylus.use :nib
doesn`t seem to work anymore. With the exact same settings, if I revert to 0.5.0 it works as expected.Stylus.setup
isn’t available. I have a Style.setup env
in my config.ru
, but none of the options seem to take effect. Cannot set debug to false, etc.Maybe I missed something with the latest release? nib and stylus are both in a package.json
file. Latest version.
Hi there! I'm bumping into another problem with the assets_hash
method, this one a little more serious than the last. In the development environment, Rails is refusing to load the stylesheet---but only about half the time---raising a Sprockets::Rails::Helper::DependencyError
like this:
Sprockets::Rails::Helper::DependencyError - Asset depends on 'favicon.ico' to generate properly but has not declared the dependency
Please add: `//= depend_on_asset "favicon.ico"` to '/Users/danielsh/Dropbox/Project/Websites/Angular/app/assets/stylesheets/application.css.styl'
(in /Users/danielsh/Dropbox/Project/Websites/Angular/app/assets/stylesheets/application.css.styl):
() Users/danielsh/.rvm/gems/ruby-2.1.1@project-staging-ng/bundler/gems/sprockets-rails-2ff626c9bfc6/lib/sprockets/rails/helper.rb:183:in `check_dependencies!'
() Users/danielsh/.rvm/gems/ruby-2.1.1@project-staging-ng/bundler/gems/sprockets-rails-2ff626c9bfc6/lib/sprockets/rails/helper.rb:74:in `compute_asset_path'
() Users/danielsh/.rvm/gems/ruby-2.1.1@project-staging-ng/bundler/gems/rails-86c53d510cf3/actionview/lib/action_view/helpers/asset_url_helper.rb:132:in `asset_path'
() Users/danielsh/.rvm/gems/ruby-2.1.1@project-staging-ng/bundler/gems/ruby-stylus-70c2932f8e38/lib/stylus/tilt/rails.rb:40:in `block in assets_hash'
sprockets (2.12.0) lib/sprockets/base.rb:341:in `block in each_logical_path'
sprockets (2.12.0) lib/sprockets/base.rb:324:in `block (2 levels) in each_file'
sprockets (2.12.0) lib/sprockets/base.rb:314:in `each_entry'
sprockets (2.12.0) lib/sprockets/base.rb:322:in `block in each_file'
sprockets (2.12.0) lib/sprockets/base.rb:321:in `each_file'
sprockets (2.12.0) lib/sprockets/base.rb:335:in `each_logical_path'
() Users/danielsh/.rvm/gems/ruby-2.1.1@project-staging-ng/bundler/gems/ruby-stylus-70c2932f8e38/lib/stylus/tilt/rails.rb:38:in `assets_hash'
() Users/danielsh/.rvm/gems/ruby-2.1.1@project-staging-ng/bundler/gems/ruby-stylus-70c2932f8e38/lib/stylus/tilt/rails.rb:22:in `build_mixin_body'
() Users/danielsh/.rvm/gems/ruby-2.1.1@project-staging-ng/bundler/gems/ruby-stylus-70c2932f8e38/lib/stylus/tilt/rails.rb:12:in `evaluate'
tilt (1.4.1) lib/tilt/template.rb:103:in `render'
sprockets (2.12.0) lib/sprockets/context.rb:197:in `block in evaluate'
sprockets (2.12.0) lib/sprockets/context.rb:194:in `evaluate'
sprockets (2.12.0) lib/sprockets/processed_asset.rb:12:in `initialize'
sprockets (2.12.0) lib/sprockets/base.rb:374:in `block in build_asset'
sprockets (2.12.0) lib/sprockets/base.rb:395:in `circular_call_protection'
sprockets (2.12.0) lib/sprockets/base.rb:373:in `build_asset'
sprockets (2.12.0) lib/sprockets/index.rb:94:in `block in build_asset'
sprockets (2.12.0) lib/sprockets/caching.rb:58:in `cache_asset'
sprockets (2.12.0) lib/sprockets/index.rb:93:in `build_asset'
sprockets (2.12.0) lib/sprockets/base.rb:287:in `find_asset'
sprockets (2.12.0) lib/sprockets/index.rb:61:in `find_asset'
sprockets (2.12.0) lib/sprockets/bundled_asset.rb:16:in `initialize'
sprockets (2.12.0) lib/sprockets/base.rb:377:in `build_asset'
sprockets (2.12.0) lib/sprockets/index.rb:94:in `block in build_asset'
sprockets (2.12.0) lib/sprockets/caching.rb:58:in `cache_asset'
sprockets (2.12.0) lib/sprockets/index.rb:93:in `build_asset'
sprockets (2.12.0) lib/sprockets/base.rb:287:in `find_asset'
sprockets (2.12.0) lib/sprockets/index.rb:61:in `find_asset'
sprockets (2.12.0) lib/sprockets/environment.rb:75:in `find_asset'
sprockets (2.12.0) lib/sprockets/base.rb:295:in `[]'
() Users/danielsh/.rvm/gems/ruby-2.1.1@project-staging-ng/bundler/gems/sprockets-rails-2ff626c9bfc6/lib/sprockets/rails/helper.rb:128:in `asset_digest_path'
() Users/danielsh/.rvm/gems/ruby-2.1.1@project-staging-ng/bundler/gems/sprockets-rails-2ff626c9bfc6/lib/sprockets/rails/helper.rb:76:in `compute_asset_path'
() Users/danielsh/.rvm/gems/ruby-2.1.1@project-staging-ng/bundler/gems/rails-86c53d510cf3/actionview/lib/action_view/helpers/asset_url_helper.rb:132:in `asset_path'
() Users/danielsh/.rvm/gems/ruby-2.1.1@project-staging-ng/bundler/gems/rails-86c53d510cf3/actionview/lib/action_view/helpers/asset_url_helper.rb:256:in `stylesheet_path'
() Users/danielsh/.rvm/gems/ruby-2.1.1@project-staging-ng/bundler/gems/rails-86c53d510cf3/actionview/lib/action_view/helpers/asset_tag_helper.rb:100:in `block in stylesheet_link_tag'
() Users/danielsh/.rvm/gems/ruby-2.1.1@project-staging-ng/bundler/gems/rails-86c53d510cf3/actionview/lib/action_view/helpers/asset_tag_helper.rb:96:in `stylesheet_link_tag'
() Users/danielsh/.rvm/gems/ruby-2.1.1@project-staging-ng/bundler/gems/sprockets-rails-2ff626c9bfc6/lib/sprockets/rails/helper.rb:175:in `stylesheet_link_tag'
app/views/layouts/application.html.haml:16:in `_app_views_layouts_application_html_haml___2989806380502984958_2184561540'
[. . .]
I tried adding the depend_on_asset
line as it asked, and it raised an error for the next image in my assets folder, then the next one, and so on down the line. I get the same error when running rake assets:precompile
, but only if I run it in development---RAILS_ENV=production rake assets:precompile
works just fine. Nothing in my config/environments/development.rb
jumps out as an obvious source of the problem; I'd set config.assets.debug = false
, but changing it back doesn't help any.
Truth be told, I don't know Sprockets well enough to really dig into the debugging, so I'd be grateful for any suggestions you might have. Thanks in advance for your help!
And start moving the ExecJS usage to a module of it's own.
Hi, I get a weird error about a missing debug module.
My config/initializers/stylus.rb
(but from my test, having it or not doesn't change anything):
Stylus.use :nib
Stylus.debug = true if Rails.env == "development"
My views/layouts/application.html.erb
loads the css normally:
<%= stylesheet_link_tag "frontend", :media => "all" %>
My css file, empty or not fails to load.
Here is the error:
Error: Cannot find module 'debug'
(in /srv/www/website.local/app/assets/stylesheets/frontend.styl)
In the generated frontend.css
, it is not my CSS, I don't know where it comes from:
body:before {
font-weight: bold;
content: "\000a ExecJS::ProgramError: Error: Cannot find module 'debug'\000a (in \002f srv\002f www\002f website.local\002f app\002f assets\002f stylesheets\002f frontend.styl)";
}
body:after {
content: "\000a \002f home\002f me\002f .rvm\002f gems\002f ruby-1.9.3-p125\002f gems\002f execjs-1.3.0\002f lib\002f execjs\002f external_runtime.rb:67:in extract_result'";
}
Any idea of what is going on? Thanks
This is my first time using Rails 3.1 asset pipeline and seeing this error when trying to include a .styl file.
I've included gem 'stylus' in the Gemfile, run "bundle install", and install Stylus with "npm install -g stylus".
I have Stylus.nib = true
in my initializer. Everything works fine in development but when I run rake assets:precompile
or run the server in production none of the Nib
functions are called and no vendor prefixes are added for all the CSS3 rules. It doesn't produce an error or anything it just doesn't call the nib stuff.
Hi there! I just noticed a little glitch in the way that this gem searches for assets. If additional arguments are added to the URL it's passed, it won't be able to locate the asset and will return an empty string. I noticed this in constructing a @font-face
declaration with Stylus:
@font-face
font-family 'AdobeClean'
src asset-url('adobe_clean/adobecleanregular.eot')
src asset-url('adobe_clean/adobecleanregular.eot?#iefix') format('embedded-opentype'),
// ...etc.
It works fine if I run the preprocessor, which just passes asset-url
through, directly...
@font-face {
font-family: 'AdobeClean';
src: asset-url('adobe_clean/adobecleanregular.eot');
src: asset-url('adobe_clean/adobecleanregular.eot?#iefix')
/* ...etc. */
...but fails in Rails, returning something like this:
@font-face {
font-family: 'AdobeClean';
src: url("/assets/adobe_clean/adobecleanit.eot");
src: format('embedded-opentype'), /* oops! */
/* ...etc. */
I'm going to poke through the code and see if I can't find a solution, but I thought I'd report it in case you can get there quicker than I. It's a bit of an edge case, since I can't imagine when you'd pass URL-encoded arguments to an asset otherwise, but it might be worth sticking in your backlog. Thanks for all your work on a great gem!
Is there any support for Rails 3.1's asset-url
property?
From what I can tell, there isn't. Any plans to incorporate it?
var.styl
q = #f00
func.styl
element {
regular: q;
darken: darken(q, 20%); /* error here */
}
test.styl
@import "var"
@import "func"
Upon compilation an error occurs on the darken (lighten, red, etc) function:
Error: /Users/john/.rvm/gems/ruby-1.9.3-p125/gems/stylus-source-0.25.0/vendor/lib/functions/index.styl:13
9|
10| require-color(color)
11| unless color is a 'color'
12| error('RGB or HSL value expected, got a ' + -string(color))
> 13|
14| // require a unit
15|
16| require-unit(n)
RGB or HSL value expected, got a ident q
at "background " (/Applications/MAMP/htdocs/Bidding-Fee-Auction/app/assets/stylesheets/func.styl:NaN)
(in /Applications/MAMP/htdocs/Bidding-Fee-Auction/app/assets/stylesheets/test.styl)
This seems to work perfectly with Stylus, so it must be an issue here. A thing to note: If the files are located in /app/assets/stylesheets/test/ rather than /app/assets/stylesheets/ it seems to work fine.
Ok so everything's working fine in development but after deploying to heroku I'm receiving an error:
Error Compiling CSS Asset
Sprockets::FileNotFound: couldn't find file './file'
(in /app/app/assets/stylesheets/path/index.css)
I'm not mistaken on the /app/app Not sure why it's /app/app
Perhaps it's the way I'm using the pipeline?
I have directories under /app/assets/stylesheets/(view)/
and in there I use an index.css sprockets manifest
and require ./mystylusfile.styl
which is in the same directory.
this method works fine for plain css files even on heroku
I have no application manifest.
Hope that makes sense. Is there a better method that I should be using?
Hi.
Firstly thank you for making Stylus work for Ruby. I've been using it with Stasis and it's really help speed up the build of my front end designs.
With the stasis gem installed you are able to require 'stylus' like you would in any other Ruby app and your files will be rendered as expected. Unfortunately I can't get the nib plugin to work.
In my Stasis project I have a controller.rb
file where I'm requiring Stylus. That works fine. But when I add Stylus.use(:nib)
I get the following error when I run Stasis.
Error: Cannot find module 'nib' (ExecJS::ProgramError)
and then some more error junk below...
from /Users/sevenupcan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:28:in `block in exec'
from /Users/sevenupcan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:41:in `compile_to_tempfile'
from /Users/sevenupcan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:27:in `exec'
from /Users/sevenupcan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:19:in `eval'
from /Users/sevenupcan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/execjs-1.4.0/lib/execjs/external_runtime.rb:33:in `call'
from /Users/sevenupcan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/stylus-0.6.2/lib/stylus/runtime.rb:17:in `exec'
from /Users/sevenupcan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/stylus-0.6.2/lib/stylus.rb:108:in `compile'
from /Users/sevenupcan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/stylus-0.6.2/lib/stylus/tilt.rb:49:in `evaluate'
from /Users/sevenupcan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/tilt-1.3.3/lib/tilt/template.rb:76:in `render'
from /Users/sevenupcan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/stasis-0.1.23/lib/stasis/plugins/render.rb:49:in `render'
from (eval):8:in `render'
from /Users/sevenupcan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/stasis-0.1.23/lib/stasis.rb:202:in `block in render'
from /Users/sevenupcan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/stasis-0.1.23/lib/stasis.rb:154:in `each'
from /Users/sevenupcan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/stasis-0.1.23/lib/stasis.rb:154:in `render'
from /Users/sevenupcan/.rbenv/versions/1.9.3-p194/lib/ruby/gems/1.9.1/gems/stasis-0.1.23/bin/stasis:31:in `<top (required)>'
from /Users/sevenupcan/.rbenv/versions/1.9.3-p194/bin/stasis:23:in `load'
from /Users/sevenupcan/.rbenv/versions/1.9.3-p194/bin/stasis:23:in `<main>'
Do you have any suggestions as to what this means?
Many thanks.
Thank you for putting your time and effort into this project. I wanted to seek some help regarding some issues I have been facing while trying to use ruby-stylus with a new Rails 4 application. The details are as follows:
Ruby version : ruby-2.0.0-p247
Node version : 0.10.17
rvm version : 1.22.10
In Gemfile:
group :development do
gem 'stylus'
end
So for any file ending with .css.styl extension the corresponding css file is not getting generated with asset pipeline and fetching such a file returns 404 error.
I tried running rake assets:precompile
and here is what the output shows:
I, [2013-09-22T20:06:45.640929 #5351] INFO -- : Writing /home/lorefnon/projects/cizzor/public/assets/home.css-2276d40239d41dc30d98a959f58933aa.styl
for a file home.css.styl
The generated file home.css-2276d40239d41dc30d98a959f58933aa.styl
simply retains the original stylus code and is not compiled to css.
I have confirmed that stylus compiler works as expected on my system when invoked through command line.
Any help in this regard would be appreciated.
Some companies will only use gems with a certain license.
The canonical and easy way to check is via the gemspec
via e.g.
spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']
There is even a License Finder to help companies ensure all gems they use
meet their licensing needs. This tool depends on license information being available in the gemspec.
Including a license in your gemspec is a good practice, in any case.
How did I find you?
I'm using a script to collect stats on gems, originally looking for download data, but decided to collect licenses too,
and make issues for missing ones as a public service :)
https://gist.github.com/bf4/5952053#file-license_issue-rb-L13 So far it's going pretty well
Rails 4 is around the corner. The first beta has been published already. I'm trying to add stylus support to a new project, but I can't.
Is rails 4 supported? How it should be added?
Thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.