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

Rolls color exports into custom POSTCSS lib #333

Merged
merged 3 commits into from
Feb 6, 2018
Merged

Conversation

drolsen
Copy link
Member

@drolsen drolsen commented Feb 4, 2018

Replaces our colors-export gulp task(s) with custom postcss plugin.

Wooop woop wop wop wop

This does a few things for us:

  • Removes the need for more plugin dependencies.
  • Control over our colors JSON formatting.
  • Removes extra watch task around exported JSON file that previously prevented build loop.

Description

  • Adds new 'styleguide' path helper
  • Adds new POSTCSS export-colors lib
  • Adds export-colors lib to postcss-plugins stream
  • Removes color export/watch from gulp.js file
  • Renames SgColorSwatch__variables.json to SgColorsSwatch__Colors.json
  • Removes gulp-task required plugins from package.json

Motivation and Context

The motivation behind this is to remove duplicate watch process on top of webpack-dev-server and inherit the colors export into the dev workflow.

How Has This Been Tested?

  • run npm or yarn dev.
  • open colors page.
  • edit a colors name in source/elements/variables/colors.css, see change in colors page.
  • edit a colors value in source/elements/variables/colors.css, see change in colors page.
  • confirm npm or yarn build, production and watch all still work

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link
Contributor

@bstaruk bstaruk left a comment

Choose a reason for hiding this comment

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

This is awesome! I wish I had thought of this myself :)

I do have a couple notes though:

  • name at colors-export.js:7 could be defined via const (prefer-const)
  • jsonObject at colors-export.js:43 could be defined via const (prefer-const)
  • missing EOL semicolon at colors-export.js:72 (semi)

These are just code style tweaks that'll bring the file inline with our eslint presets/rules.

I'd be happy to make these changes myself, just give me the word. Wanted to make sure you were aware before I made any moves.

@drolsen drolsen merged commit 7fbb84f into develop Feb 6, 2018
@drolsen drolsen deleted the colors-rollup branch February 8, 2018 02:05
@drolsen drolsen mentioned this pull request Mar 20, 2018
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