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

fixed the naming for Sass/Scss in documentation, tests, formats #222

Merged
merged 6 commits into from
Jan 30, 2019
Merged

fixed the naming for Sass/Scss in documentation, tests, formats #222

merged 6 commits into from
Jan 30, 2019

Conversation

didoo
Copy link
Contributor

@didoo didoo commented Dec 23, 2018

Issue #, if available:
#213

Description of changes:
I have renamed the sass/map-*** formats to scss/map-*** and updated some documentation.

We have to consider that this is technically a breaking change, so it's better to consider how to release it. One possibility is to include it in the next "major" release (3.0). One other is to release it as "minor", but show an error message for the users that are using the "old" format name (I don't know if it's possible, maybe someone has better ideas? I'm open to suggestions)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@didoo
Copy link
Contributor Author

didoo commented Dec 23, 2018

I have pushed a commit with a proposed solution to avoid breaking changes: the idea is to have the sass/map-*** as duplicates (do you know if it's possible to call another format directly, as a function, in formats.js, to avoid duplication of code?), but add a warning message that alerts the user that soon will be removed. If it's ok we can keep it, otherwise I can easily revert it.

@dbanksdesign
Copy link
Member

Instead of having a deprecation warning for 'sass/map-' formats, could we have a warning that those formats have moved to 'scss/map-' and say the sass formats will now be sass syntax? I still need to figure out how to do maps in sass syntax...

@didoo
Copy link
Contributor Author

didoo commented Jan 5, 2019

@dbanksdesign I have made this very rough test: I have extracted from https://adele.uxpin.com/ the design systems that declare are using Sass (filter in the column "CSS"); they are around 45.

I have then checked for all of them which syntax flavor they are using, sass or scss, and here are the results: https://docs.google.com/spreadsheets/d/17KYJwxR1hbfkT60Isq9v7ZOlPYZZBe7kjimLGsD1acQ/edit?usp=sharing

As you can see (and as I suspected) out of 40 design systems only 1 is using sass syntax, all the others are using scss. Why this exercise? To justify why, for me, we should avoid having/supporting a double format in Style Dictionary. Because almost everyone is using scss, and because having both would lead to inevitable confusion (how many would use sass when they actually mean scss, like I did?). I know is not statistically accurate, but I think this is a strong indicator for a KISS approach here.

# Conflicts:
#	__tests__/formats/__snapshots__/all.test.js.snap
@dbanksdesign
Copy link
Member

Hmm I see your point. Thanks for compiling that spreadsheet. Not that we should be comparing style dictionary to theo, but theo does have sass and scss formats. Although they only have scss maps, and not sass maps.

I did finally figure out how to write maps in sass syntax:

$tokens: (color-background-base: #f0f0f0, color-background-alt: #eeeeee)

It has to be on 1 line because of the whitespace syntax I think. That might be why they don't do a sass map format?

I guess this discussion brings up a larger point of what is the bar to include transforms and formats in the framework itself? I don't have a good answer for that. I would lean towards including more if they are about language syntax, even if they are less popular languages. If it helps 2 people to not have to write their own format, I would say that is a win.

How about this, what if we didn't explicitly say "deprecate" in the warning message, but instead say that those formats moved to 'scss/map-'. We could merge this and then have a larger discussion about what formats should be included? Maybe we could create a new issue relating to sass formats and see the response, if it gets enough we add them in at that point?

index.js Outdated
var sass_map_format_warnings = GroupMessages.flush(SASS_MAP_FORMAT_DEPRECATION_WARNINGS).join('\n ');
console.log(chalk.bold.yellow(`
⚠️ DEPRECATION WARNING ️️️️️⚠️
The formats 'sass/map-***' have been renamed to 'scss/map-***', please update your config accordingly (will be soon removed).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar to Danny's thoughts, what if this said something like:

The formats 'sass/map-' have been renamed to 'scss/map-', please update your config. In the future 'sass/map-***' formats may output actual SASS instead of SCSS , which may break your current configuration.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure what the exact right message is - @dbanksdesign thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@chazzmoney I like your message. if it's ok for @dbanksdesign I'll update it

Copy link
Member

Choose a reason for hiding this comment

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

Lets do it!

@didoo
Copy link
Contributor Author

didoo commented Jan 16, 2019

I would lean towards including more if they are about language syntax, even if they are less popular languages. If it helps 2 people to not have to write their own format, I would say that is a win.

Well, it depends:

  • how much is the (future) cost of maintenance of that extra feature? (imagine the impact of a refactoring, of fixing failing tests, etc)?
  • how much complexity does it add to the overall codebase/project?
  • how much makes things less clear for a new user?
  • etc

I tend to apply the Pareto principle in this kind of cases ;)

(also, I have seen too many open-source projects explode (and maintainers go in burnout) because of feature creep).

@dbanksdesign
Copy link
Member

Very true. I have talked to some people about the idea of making style dictionary more like webpack, where people can publish extensions/plugins (or in our case transforms/formats/actions) so someone could publish a sass-style-dictionary package that adds sass specific transforms/formats. Then we wouldn't really need to worry about what we include in the core library as much. And actually, the node example PR is the first step to make that happen...

@didoo
Copy link
Contributor Author

didoo commented Jan 19, 2019

I have updated the message. This is how it looks like in the console now:
screenshot_2249

Copy link
Member

@dbanksdesign dbanksdesign left a comment

Choose a reason for hiding this comment

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

LGTM! :shipit:

@chazzmoney
Copy link
Collaborator

chazzmoney commented Jan 29, 2019

@didoo I merged a bunch of things and the custom-format change caused a small conflict here. Can you update this one? Then we can merge.

Sorry for the inconvenience.

@didoo
Copy link
Contributor Author

didoo commented Jan 30, 2019

@chazzmoney strange, I pulled upstream/develop and merged it into my branch, and there were no conflicts. can you check if everything is OK now?

@dbanksdesign
Copy link
Member

Looks good to me!

@dbanksdesign dbanksdesign merged commit 37006d9 into amzn:develop Jan 30, 2019
@didoo didoo deleted the fix_sass_scss_naming branch February 4, 2019 21:57
dbanksdesign added a commit that referenced this pull request Feb 5, 2019
* feat: add registerFilter method (#233)
* doc: remove registerTemplate from examples (#232)
* feat: add node example (#228)
* feat: making include accept an array of globs, like source does (#227)
* fix: the naming for Sass/Scss in documentation, tests, formats, fixes #213 (#222)
* fix: handle showFileHeader option in androids formats templates, fixes #237
 (#243)
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.

3 participants