I am running rails 3.2.11.
I am using a JS plugin (epiceditor) that requires me to have several static files that the js calls. In development, I am able to access the files via asset pipeline easily.
In production, I have already set serve static assets to be true, but it still does not show up.
config.serve_static_assets = true
The files are saved in the assets directory:
- assets
- stylesheets
- epiceditor
In Development, it works:
In production, it does not work:
JS Code being executed to insert the css:
function _insertCSSLink(path, context, id) {
id = id || '';
var headID = context.getElementsByTagName("head")[0]
, cssNode = context.createElement('link');
_applyAttrs(cssNode, {
type: 'text/css'
, id: id
, rel: 'stylesheet'
, href: path
, name: path
, media: 'screen'
});
headID.appendChild(cssNode);
}
What I see in the console:
Resource interpreted as Stylesheet but transferred with MIME type application/json: "http://www.fulfilled.in/assets/epiceditor/epiceditor.css". application.js:30
(anonymous function)
Couple things.
1st. Static assets don't have anything to do with the assets directory. Static assets are those stored in the public directory in your app. There's where the asset pipeline compiles the assets.
2nd. Look in your app/assets/stylesheets/application.css and see if the epiceditor is required there, so it would be precompiled along with the other assets. use ither
require epiceditor/epiceditor
orrequire_tree epiceditor
orrequire_tree .
. The last one will compile all the assets in your folder, btw.3rd. Are you using an http-server (Apache or Nginx) in production? If so, you should turn off the static_assets serving, 'cause it will be handled by the server, and look into your server configurations.