Sprockets require asset over HTTP

2019-08-14 07:23发布

问题:

I would like to know if it's possible to require some assets over HTTP, eg:

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 *= require_tree .
 *= require 'http://assets.domain.com/stylesheets/style.css'
*/

I get a Sprockets::FileNotFound error with this snippet.

Thank you

回答1:

The Sprockets readme notes that require takes a path, and makes no reference to pulling things off HTTP.

The JurassicCoffee project for .NET appears to have added the ability to load files over HTTP.

Same question but with JS...