Я новичок в Rails и извиняюсь, если это глупый вопрос. Но я не могу решить свою проблему: я добавил Bootstrap в новое приложение, но он по-прежнему не использует никаких новых стилей.Ассемблерный трубопровод не работает в 'application.scss' в моем приложении Rails 4.2
Я переименовал application.css в application.scss и создали такую структуру:
|-stylesheets
|-elements
|--articles
|---article.scss
|-application.scss
Application.scss
/* User styles
* Plugins first
*/
@import "bootstrap-sprockets";
@import "bootstrap";
@import "elements/**/*";
/*
* 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 vendor/assets/stylesheets of plugins, if any, 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 styles
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
* file per style scope.
*
*= require_self
*/
В Gem файл я добавил
source 'https://rubygems.org'
ruby '2.2.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2'
# Установка Bootstrap
gem 'sass-rails'
gem 'bootstrap-sass'
#Autoprefixer optional, but recommended. It automatically adds the proper vendor prefixes to your CSS code when it is compiled.
gem 'autoprefixer-rails'
application.js
//= require jquery
//= require jquery_ujs
//= require bootstrap-sprockets
//= require_tree .
Я пытался писать какие-либо правила стиля в article.scss, но мое приложение не использует их, так как любые Bootstrap стилей.
Попробуйте переименовать файл: application.css.scss –
Спасибо за быстрый ответ. Но это не помогает – InspiredByMoon
Попробуйте указать относительный путь к article.scss вместо элементов '@import '/ **/*"; '. Это работает? –