Try using Stylus in your Rails application

I am trying to install and use Stylus in a new rails app.

First, I created a new rails app: rails new try-stylus

Then I ran the command: sudo npm install stylus

And I added gem 'stylus'

to mine Gemfile

and ran bundle

to install it.

At application.rb

the end of the class, Application < Rails::Application

I added:

if defined? 
   Stylus.debug = Rails.env != "production"
end

      

I renamed application.css

to application.styl

and edited its content:

//= require_tree .
//= require_self

body
  background red

      

I created a simple one PageController

with an action index

displaying the Hello world template index.html.erb

.

In the end, I ran rails s

.

And got the following error in my browser:

Displaying /.../ app / views / layouts / application.html.erb where line # 5 is raised: ExecJS :: ProgramError in Pages index # TypeError: undefined is not a function

Where line 5: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>

Do you have any hints?

+3
ruby-on-rails npm stylus


source to share


No one has answered this question yet

Check out similar questions:

1339
How can I rename a database column in Ruby on Rails migrations?
941
Understanding Rails Authentication ID
876
Brief explanation of nil v. Empty v. Blank in Ruby on Rails
2
rails EXECJS runtime error
1
Getting errors in CSS with Ruby on Rails
0
rails ckeditor not working with turbolinks
0
Rails, endless CSS request (CSS not loading)
0
Emberjs runs on rails
0
JQVMAPS does not render in Rails app
0
Error when trying to open http: // localhost: 3000 / pages / home



All Articles
Loading...
X
Show
Funny
Dev
Pics