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

Allow sidecar CSS files #57

Merged
merged 3 commits into from
Oct 2, 2019
Merged

Allow sidecar CSS files #57

merged 3 commits into from
Oct 2, 2019

Conversation

joelhawksley
Copy link
Member

@joelhawksley joelhawksley commented Oct 2, 2019

This PR tightens our template file lookup logic so that non-template files do not trigger the multiple-sidecar-files error.

[Fixes #55]

@joelhawksley joelhawksley requested a review from a team October 2, 2019 17:14
Copy link
Contributor

@kenyonj kenyonj left a comment

Choose a reason for hiding this comment

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

Looks great! I am excited to see this. Didn't really think about having localized css files.

@@ -117,19 +117,19 @@ def template_file_path

filename = self.instance_method(:initialize).source_location[0]
filename_without_extension = filename[0..-(File.extname(filename).length + 1)]
sibling_files = Dir["#{filename_without_extension}.*"] - [filename]
sibling_template_files = Dir["#{filename_without_extension}.????.{#{ActionView::Template.template_handler_extensions.join(",")}}"] - [filename]
Copy link
Contributor

Choose a reason for hiding this comment

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

Thoughts on using single quotes within the double quotes to make clear that you aren't stopping the outer double quotes?

Also, TIL ????

Suggested change
sibling_template_files = Dir["#{filename_without_extension}.????.{#{ActionView::Template.template_handler_extensions.join(",")}}"] - [filename]
sibling_template_files = Dir["#{filename_without_extension}.????.{#{ActionView::Template.template_handler_extensions.join(',')}}"] - [filename]

@joelhawksley joelhawksley merged commit 507c800 into master Oct 2, 2019
@joelhawksley joelhawksley deleted the 55/sidecar-css branch October 2, 2019 19:16
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.

Best practice for CSS?
2 participants