Update change log#925
Conversation
There was a problem hiding this comment.
@jeremiak did we completely figure out npm support? Like could I currently do npm install and @import 'wds' and it'll work?
There was a problem hiding this comment.
Well, we're using it on Federalist but we run the build task on our side and then we move that CSS around. See scripts here
I'm curious, what would you expect if you were to import 'wds'?
There was a problem hiding this comment.
yea I guess its two different use cases.
import "wds"; would import the scss file which you then compile. There's also the use case of like require('wds') using webpack, which could be the CSS. We'd potentially have a different npm module for the Sass files, I've seen this done before.
For when we're publishing this to npm, I don't think you should have to build it to get the CSS, which is what federalist is doing now. You should npm install it, and the CSS should be compiled somehwere, and then I think there's even something like a "main-css" directive you can put in package.json to point to it.
Also, what is the plan to publish this on npm?
There was a problem hiding this comment.
I like the approach that Bootstrap uses:
- There will be a
cssand ascsskey in thepackage.jsonthat each point to a file. Themainkey in thepackage.jsonwill point to the main javascript for the library. This means that if yourequire('uswds')you will get the main JavaScript file, not the CSS. - To get to the
cssandscsskeys programatically one couldrequire('uswds/package.json').cssorrequire('uswds/package.json').scss
I don't think we should commit compiled code to Github, instead using npm prepublish scripts and maybe even having Travis build and publish when appropriate.
|
Since I've scrubbed in to try to help @maya with this, I've run into some questions for @jeremiak and @msecret. So when we talk about "npm support", we're talking about being able to write browser-only JavaScript that can // npm.js
// Compiled using: browserify npm.js -o index.js
'use strict';
require('uswds');And then in the HTML file: <script src="./assets/js/vendor/jquery-1.11.3.min.js"></script>
<script src="./index.js"></script>This seems to behave in my browser; whereas And these programmatic
Point being, if we add these keys, we'll have to document how to use them. So basically, the "main": "assets/js/components.js",
"scripts": {
"build-sass": "node-sass assets/_scss/all.scss > assets/css/uswds.css",
"prepublish": "npm run build-sass build"
},
"assets": "assets/",
"css": "assets/css/uswds.css",
"scss": "assets/_scss/all.scss", |
|
Cool, I'll take a look at the PR @mbland but also wanted to answer your question. In my opinion the benefit of having the library on NPM is that it can be a declared dependency to ease installation and deployment. If you are As far as those other keys, they're definitely not yet standards with regards to their semantic meaning or place in As an example, on Federalist we use the |
|
No, I get the benefit of npm packaging. I was checking whether my understanding of how it would be used is (now) correct, that it would be |
This updates the change log to include changes for the next release
v0.9.0.TODO: