A
A
Anton Misyagin2015-08-25 20:59:44
Ruby on Rails
Anton Misyagin, 2015-08-25 20:59:44

How to make friends compass and precompile assets?

I am completely confused. I'm trying to put the project in production, but it rests. It was decided to compile the assets on a local computer, then upload them to the server.
The project involves compass and sprites. Icons for sprites are in app/assets/images/theme-name/icons folder. When the development server is started, the images are collected into a sprite and placed in the app/assets/images/theme-name/icons-xxxxxxxxxxxxxxxxxx.png file. And everything works great.
I run rake assets:precompile into the /public/dev-assets/theme/name/icons folder, individual pictures get there, but I need roughly 4 sprites (I have 4 themes), one in each /public/dev-assets/ folder theme-name /icons-xxxxx.png.
As I understand it, sprockets studies app/assets/images and all the pictures indiscriminately fuss in /public/dev-assets. I removed the icons from /app/assets/images to /icons, moving the entire folder structure. Those. now in the project folder /icons/theme-name/icons

environments/development.rb

config.compass.project_type = :rails
  config.compass.environment = :development
  config.compass.images_dir = 'icons'
  config.compass.generated_images_dir = 'public/dev-assets/icons'
  config.compass.output_style = 'expanded'
  config.compass.relative_assets = true
  config.compass.line_comments = true

sass styles:
@import 'compass'
@import "compass/utilities/sprites"

$icons-layout:smart
@import "grey/icons/*.png"
@include all-icons-sprites

I run rails s in development, I get an error:
No files were found in the load path matching "grey/icons/*.png". Your current load paths are: F:/myapp/app/assets/images, F:/myapp/app/assets/javascripts, F:/myapp/app/assets/stylesheets
(in F:/myapp/app/assets/stylesheets /styles_grey_theme.sass:5

Maybe I'm not really understanding how things like this are done. How does it work for you?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
@
@codingal, 2015-08-25
_

The problem is in the paths
those. counts per folder
To add a directory to your environment's load path, use the append_path and prepend_path methods. Directories at the beginning of the load path have precedence over subsequent directories.
environment = Sprockets::Environment.new
environment.append_path 'app/assets/javascripts'
environment.append_path 'lib/assets/javascripts'
environment.append_path 'vendor/assets/jquery'
those. in its class, you need to practically hardcode all the directories with themes

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question