Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Namespace engine assets #1672

Merged
merged 1 commit into from
Jun 13, 2011
Merged

Conversation

ryanb
Copy link
Contributor

@ryanb ryanb commented Jun 13, 2011

This changes the plugin new --mountable generator so it places javascript/stylesheet/image engine assets in their own namespaced directory so they don't conflict with those in the main app. Instead of app/assets/javascripts/application.js it places it in app/assets/javascripts/ENGINE_NAME/application.js. It also changes the application.html.erb layout file to use the new path.

@josevalim
Copy link
Contributor

Hey @ryanb, thanks for the patch! Shouldn't the layout file be namespaced as well to avoid conflicts? Otherwise the one in the app will have higher preference.

@ryanb
Copy link
Contributor Author

ryanb commented Jun 13, 2011

I believe the layout file is already namespaced. It is generated under app/views/layouts/ENGINE_NAME/application.html.erb.

On a similar note, it would be nice if there was some way to set the asset prefix at the engine config level just like we do with isolate_namespace. Then if we have <%= image_tag "foo.png" %> it would expand to /assets/ENGINE_NAME/foo.png. It looks like there's a config.assets.prefix setting in Rails itself, but it doesn't look like this is exposed to the engine railtie.

@josevalim
Copy link
Contributor

@ryanb: right, my bad about the layout. and yes, image_tag should work transparently, this is how it works without sprockets but it seems it was not added to sprockets itself. :(

josevalim added a commit that referenced this pull request Jun 13, 2011
@josevalim josevalim merged commit c41c442 into rails:master Jun 13, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants