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

Add CLI - generates css and writes to a file #41

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

opsb
Copy link
Contributor

@opsb opsb commented Jul 15, 2017

This is a first cut of the cli, with it you can do

style-elements StylesheetModule stylesheetFunction -o my.css

A few questions

  1. Which versions of node do we want to support? (EDIT - now supports node 4+)
  2. Should it be a sub-command? e.g.
style-elements preprocess StylesheetModule stylesheetFunction -o my.css
  1. Any preferences over where to keep the files?

  2. There's a mode option which can be layout (default) or viewport. Can you think of a better name for the option?

A note of thanks to @rtfeldman for elm-css, from which I shamelessly stole lots of this code :)

EDIT: Added (4)

@opsb opsb force-pushed the cli branch 5 times, most recently from eb48218 to 1f8ff93 Compare July 15, 2017 09:52
@opsb opsb changed the title Add cli - generates css and writes to a file Add CLI - generates css and writes to a file Jul 15, 2017
@opsb opsb force-pushed the cli branch 10 times, most recently from 91346e6 to 4684daf Compare July 15, 2017 12:01
@opsb
Copy link
Contributor Author

opsb commented Jul 15, 2017

Did a little testing with old versions of node. This PR is node 4+ compatible with the exception of the destructuring which is available in node 5 behind a flag and node 6+ by default. I think it's probably worth swapping out the destructuring for broader compatibility.

@opsb
Copy link
Contributor Author

opsb commented Jul 15, 2017

I've swapped in some older style syntax and it now runs against node 4 (tested against node 4.8.4).

@opsb
Copy link
Contributor Author

opsb commented Jul 15, 2017

I've added in the css normalize now, there's a new option called mode which default to layout can be set to viewport e.g.

style-elements StylesheetModule stylesheetFunction -m viewport -o my.css

To allow this I needed to add Element.toLayoutCss and Element.toViewportCss (Element.Internal.Render isn't exported by the library).

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.

1 participant