I tried precompiling app assets in production mode but instead of getting one stylesheet and one javascript file, i got a zipped version of each stylesheet and each javascript file in the assets folder in the public directory. Any suggestions on how to precompile assets in the way they are meant to be?

有帮助吗?

解决方案

View the source of the web page in browser, look for files in the format of application-6080907526369cfb5b4.css and application-1c1aeb834ae6289d02ed5499.js. If you can find these files it means, the assets are being precompiled and being used. There are many files which are being created when you check the folders which includes files with an extension .js.gz and .css.gz in case you are on a unix m/c.

I would suggest you to refer : asset pipeline provides a framework to concatenate and minify or compress JavaScript and CSS assets

From the Docs,

When files are precompiled, Sprockets also creates a gzipped (.gz) version of your assets. Web servers are typically configured to use a moderate compression ratio as a compromise, but since precompilation happens once, Sprockets uses the maximum compression ratio, thus reducing the size of the data transfer to the minimum

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top