onedesign / generator-one-base

A foundation for One Design Company projects on the web.
Other
1 stars 1 forks source link

`main.scss` EJS template doesn't get parsed when copying. #140

Closed cmalven closed 6 years ago

cmalven commented 6 years ago

generators/styles/templates/main.scss is actually an EJS template expecting to get passed an object that describes the deps for the project. Currently that object is not being passed in – we're not even actually using copyTpl to copy the file – so it gets copied over to the project with all of the EJS still intact. Not good.

As a related aside…

I think we should be continuing to parse this file as EJS, and I think we should be doing the same with the _variables.scss file that we're currently populating by appending chunks to the file from a JSON file (https://github.com/onedesign/generator-one-base/blob/feature/base-generator-v2/generators/styles/index.js#L67). The approach we're currently using for _variables.scss is more difficult to comprehend and most importantly it makes actually updating that SCSS more cumbersome. I don't think anybody loves having EJS in their SCSS, but its better than this. At the very least, we should be appending the individual pieces of the _variables.scss file from .scss templates, not from a .js config file. I think we want as little separation between the template source files in the generator and the final files that are output, otherwise its confusing and will discourage people from working with those files.

cmalven commented 6 years ago

Also noticed that the resulting _variables.scss gets the indentation for the file wrong, which causes styleLint to go crazy with indentation linting errors.

cmalven commented 6 years ago

I'm willing to take this, #146, #148, and #152 if everyone is okay with moving back to EJS parsing of stylesheet files. These are the only issues currently blocking me from starting to test v2 for actual project work.

mkornatz commented 6 years ago

I don't have a strong opinion on parsing stylesheet files. I'm ok with ejs. @brianjhanson, thoughts?

brianjhanson commented 6 years ago

I mostly don't like it from an aesthetic point of view (screws up syntax highlighting and in order to get indentation right you have to format it weird), but those are pretty minor complaints, so I'm fine with it.

cmalven commented 6 years ago

@brianjhanson I'm with you. I wish it was nicer. But it is the only officially supported templating language for Yeoman, and I think there are some EJS features we can use to make the indentation thing less of an issue.

cmalven commented 6 years ago

https://github.com/mde/ejs/issues/89#issuecomment-129057775