-
Notifications
You must be signed in to change notification settings - Fork 23
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
Add Ember CLI Rails Loader #34
Add Ember CLI Rails Loader #34
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@djones Nice work, this looks excellent.
Two tiny comments above. Also, whatever happened to the EmberCli.compile!
step?
next if File.size(path) > MAX_FILESIZE_BYTES | ||
|
||
# Replace the assets_dir with the base_url to generate the resource_url | ||
resource_url = File.join(base_url, path.sub(root_path.to_s, '')) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work on Windows because this is a URL and File.join
uses the OS path separator instead of always forward slashes, so you'll get \main.css
. Need to find a URL joiner or use the old join code.
@@ -109,6 +116,28 @@ def iframes_resources | |||
rescue ::Capybara::NotSupportedByDriverError | |||
[] | |||
end | |||
|
|||
def _resources_from_path(root_path, base_url: '/') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: could you rename this to _resources_from_dir
and root_dir
arg for clarity / slightly more consistency with some other places in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fotinakis cool, will do that.
Ahh I see that |
@fotinakis yeah, and honestly I think that is the right approach anyway. Feels weird for the loader to fire off asset compilation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 🍰 🎉
Adds support for loading in assets from both Ember and Rails when using Ember CLI Rails
Configuration
In your
spec_helper.rb
file you need to configure use of this loader like so:You would have the above configuration if you have something like this in your
routes.rb
file:Example App
percy/example-ember-cli-rails#1
Todo
Percy::Capybara::Loaders::EmberCliRailsLoader