Due to a specific setup, I would like to split the compiled stylesheets in two files. This is because (a part of) the CSS is needed for a Java application which can parse the CSS, but it is a bit buggy and can’t handle some css-(hack)-syntax. Because I am unable to modify this Java application, I want to feed it only the CSS which it needs and of which I can make sure it is correct.
So, normally the assets pipeline would produce just one ‘/assets/application-[..].css’ file. It would to let it also generate ‘/assets/custom-[..].css’, based on a file selection I make. This still can be pre-compiled.
Is there a way to do this? Although I understand this is not the ideal setup..
To tell rails about additional files you wish to have precompiled, you can add them to the
config.assets.precompilesetting.You only see
application.cssin your HTML because that’s the only file you’re includingIf you have some
custom.css.scssin yourapps/assets/stylesheetsdirectory, it will be compiled just likeapplication.css.For example, I might have
in
app/assets/stylesheets. In the top of the non-partial files I will putto include
_common.css.scss. I can now reference either stylesheet independent of one another in a layout.