简体   繁体   中英

How to use sass in rails4?

i have installed sass by using

in my Gemfile

gem 'sass-rails', '~> 5.0'

and run

bundle install

i am sure that sass was installed

but how to import it into html.erb???

SASS is a CSS-Engine

HAML is a HTML-Engine


using sass-rails is setting up your assets pipeline to also use .sass or .scss files instead of regular css files.

exmaple for sass is

a
 color: #fff
 margin: 10px
 &:hover
   color: red

inside of your application.css then you just require all those files you need to have ie //=require my_styles.sass

haml is the template engine which allows you to use haml files. gem 'haml-rails is enabling it.

then you can use templates like

.wrapper
  %h1 My HAML Headline
  %h2= @page_title

  .col-md-12.strong
    %span GTFO :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM