Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Export separate file with SCSS variables, functions and mixins (variables.scss) for library users #217

Merged
merged 2 commits into from
Jun 11, 2019

Conversation

earshinov
Copy link
Contributor

@earshinov earshinov commented Jun 11, 2019

In madoar/angular-archwizard-demo#40 (comment), it became apparent that angular-archwizard should export a separate file with SCSS variables so that this file can be safely imported into component's style file without causing style duplication.

One option would be reorganize source *.scss files so that they could be exported as is. It would simplify the build process (scss-merge would no longer be necessary), but on the other hand all styles would need to be placed into just two files (archwizard.scss and variables.scss), which I find limiting and not very convenient for development. The reason why we have build tools is to structure the source files the way we need.

Another option, which I went for, is to enhance the build process to extract the file with variables automatically. I did not find a ready-to-use script which would suit this purpose perfectly, so I wrote my own little tool:

I did my best to make this project as robust as possible (with unit tests etc.), so hopefully it is acceptable to add this project as development dependency to angular-archwizard.

…addition to `@wz-define-style`.

They might come in handy for library uses, as become apparent in the demo project.
@earshinov earshinov changed the title Expose variables.scss Export separate file with SCSS variables, functions and mixins (variables.scss) for library users Jun 11, 2019
@madoar
Copy link
Owner

madoar commented Jun 11, 2019

Looks interesting. Just to clarify:
When we're talking about extracting we mean:

  • removing the variable/constant definition from the initial source file
  • add the variable/constant definition to a new previously not existing variables.scss file
  • add an additional import to the new variables.scss file to the initial source file

right?

@madoar
Copy link
Owner

madoar commented Jun 11, 2019

Additionally I would recommend your adding some batches to the project page (i.e. npm, codacy for code style and coverage).

@earshinov
Copy link
Contributor Author

right?

Yes, precisely. I think I need to add an example input and output to the project's README to clarify.

(i.e. npm, codacy for code style and coverage).

Good idea. Will do.

@madoar madoar merged commit c527825 into madoar:develop Jun 11, 2019
@earshinov earshinov deleted the expose-variables-scss branch June 11, 2019 21:35
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants