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

Supply ASSET_HOST to webpack for internal asset compilation #224

Merged
merged 1 commit into from
Apr 12, 2017
Merged

Supply ASSET_HOST to webpack for internal asset compilation #224

merged 1 commit into from
Apr 12, 2017

Conversation

gauravtiwari
Copy link
Member

@gauravtiwari gauravtiwari commented Apr 3, 2017

Related to #208

With CDN

 {
"app.js": "//d309ficnxxdltp.cloudfront.net/entries/app-15c9cd01cb8b89b930bf.js",
"lacuna-webfont.woff": "//d309ficnxxdltp.cloudfront.net/entries/lacuna-webfont-0eb6add367ef5fc69c4569894525bd52.woff" 
}

Without CDN

{
"app.js": "/entries/app-dd8750c877fb3fcd1082.js",
"lacuna-webfont.woff": "/entries/lacuna-webfont-0eb6add367ef5fc69c4569894525bd52.woff" 
}

@gauravtiwari
Copy link
Member Author

@schovi Please could you review this PR?

Copy link

@schovi schovi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome 👍

@gauravtiwari
Copy link
Member Author

thanks for reviewing @schovi 🍰 🍫

@gauravtiwari gauravtiwari merged commit 814caba into rails:master Apr 12, 2017
@gauravtiwari gauravtiwari deleted the fix/asset-host branch April 12, 2017 13:35
@tarr11
Copy link

tarr11 commented Apr 21, 2017

This breaks javascript_pack_tag if asset_host is not prefixed with a protocol. Note: You have to run rake assets:precompile to generate a new manifest to test this bug. It occurs because the manifest contains the CDN path, and will not happen if you do not precompile the assets (and associated manifest.json)

Breaks:

config.action_controller.asset_host = 'assets.example.com'

Generates malformed URLs:

 <script src="http://assets.example.com/javascripts/assets.example.com/packs/application-58fb4673fe4502e4714c.js"></script>

Works:

config.action_controller.asset_host = '//assets.example.com'

Generates correct URLs:

 <script src="//assets.example.com/packs/application-58fb4673fe4502e4714c.js"></script>

Since most of the examples and scaffold code is of the non-protocol form, this should probably be fixed.
http://api.rubyonrails.org/classes/ActionView/Helpers/AssetUrlHelper.html

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.

3 participants