Save 36% for Black Friday! Learn more

New Discussion

Notifications

You’re not receiving notifications from this thread.

splitting asset pipeline for front and backend

1
Rails

app has a consumer facing part and large backend/CMS part.
our assets (JS and SCSS) are precompiled into a very large file
in layouts we have a different layout for front- and backend

Is it possible to split assets:precompile into a front end and a backend part?

using asset_sync gem and fog

My understanding of your situation is that you have 2 different systems sharing the same JS and SCSS and therefore compiling into 1 big JS file and 1 big CSS file?

If that's the case and you're using Sprockets/AssetPipeline, you can split your CSS/JS into multiple folders with the main file named application.js or application.scss and Rails will compile them separately. Same can be done with Javascript.

Example:

# assets/stylesheets/backend/application.scss
# assets/stylesheets/frontend/application.scss

In your layout's stylesheet_link_tag, you just have to update the path accordingly.

Join the discussion
Create an account Log in