Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Conversation

bbugh
Copy link

@bbugh bbugh commented Oct 21, 2017

Description of the Change

Sprockets 4 beta (finally) adds functionality for compiling ES6 as part of the asset pipeline. Hurray! They've decided that the filename must end in .es6, which when combined with .erb like .js.erb ends up with files like bestfileever.es6.erb. Unfortunately, this package doesn't recognize that. This very tiny PR adds .es6.erb to the fileType list so that it selects the file syntax correctly (currently it's guessing HTML).

Here's where Sprockets describes this setup: https://github.com/rails/sprockets/blob/master/UPGRADING.md#es6-support

Benefits

People who are trying to use modern JavaScript in their Rails files won't have to suffer with HTML syntax or have to manually choose the file type over and over.

Possible Drawbacks

Sprockets might choose to use some other sane file extension (like .js.erb ?!) but we're stuck with it for now. If that happens, this package would still be covering the existing cases.

Applicable Issues

There was surprisingly no tests for fileType selection for any of the grammars, and I'm unsure how to add them. It worked on my machine® though.

'name': 'JavaScript (Rails)'
'fileTypes': [
'js.erb'
'js.erb',
Copy link
Contributor

Choose a reason for hiding this comment

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

No comma needed!

@winstliu
Copy link
Contributor

There was surprisingly no tests for fileType selection for any of the grammars

Filetypes have been simple enough thus far that we haven't had to add specs for them :).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants