Skip to content

Commit

Permalink
Add jss-starter-kit
Browse files Browse the repository at this point in the history
  • Loading branch information
appsforartists committed Dec 19, 2018
1 parent 97c5707 commit 64d855a
Show file tree
Hide file tree
Showing 9 changed files with 197 additions and 7 deletions.
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Next / 2018-09-16
## Next / 2018-12-18

- [jss-starter-kit] Introduced `jss-starter-kit.bundle.js`, which packages all the other libraries into one import for playgrounds like Codepen. ([#936](https://github.com/cssinjs/jss/pull/936))
- [jss] Fix multiple cases where linking CSS rules didn't work ([#815](https://github.com/cssinjs/jss/pull/815), [#710](https://github.com/cssinjs/jss/pull/710), [#664](https://github.com/cssinjs/jss/pull/664))
- [jss] Added support for Typed CSSOM values ([#882](https://github.com/cssinjs/jss/pull/882))
- [jss] Added scoped keyframes support ([#346](https://github.com/cssinjs/jss/pull/346))
Expand Down
3 changes: 3 additions & 0 deletions docs/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ yarn add jss

For bower or direct script injection use [unpkg](https://unpkg.com):

Unminified, bundled ESM:
https://unpkg.com/jss-starter-kit/dist/jss-starter-kit.bundle.js

Unminified UMD:
https://unpkg.com/jss/dist/jss.js

Expand Down
31 changes: 31 additions & 0 deletions packages/jss-starter-kit/.size-snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"dist/jss-starter-kit.js": {
"bundled": 82381,
"minified": 33203,
"gzipped": 9557
},
"dist/jss-starter-kit.min.js": {
"bundled": 81265,
"minified": 32683,
"gzipped": 9306
},
"dist/jss-starter-kit.cjs.js": {
"bundled": 2480,
"minified": 2273,
"gzipped": 682
},
"dist/jss-starter-kit.esm.js": {
"bundled": 1408,
"minified": 1302,
"gzipped": 452,
"treeshaked": {
"rollup": {
"code": 836,
"import_statements": 541
},
"webpack": {
"code": 2342
}
}
}
}
8 changes: 8 additions & 0 deletions packages/jss-starter-kit/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The MIT License (MIT)
Copyright (c) 2014-present Oleg Isonen/Slobodskoi & contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
48 changes: 48 additions & 0 deletions packages/jss-starter-kit/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"name": "jss-starter-kit",
"description": "A bundle to get you started playing with JSS. Not optimized for production deployment.",
"version": "9.8.4",
"license": "MIT",
"homepage": "https://cssinjs.org/",
"main": "dist/jss-starter-kit.cjs.js",
"module": "dist/jss-starter-kit.esm.js",
"unpkg": "dist/jss-starter-kit.bundle.js",
"typings": "./src/index.d.ts",
"author": {
"name": "Oleg Slobodskoi",
"email": "[email protected]"
},
"repository": {
"type": "git",
"url": "[email protected]:cssinjs/jss.git"
},
"bugs": {
"url": "https://github.com/cssinjs/jss/issues/new"
},
"files": [
"dist",
"src",
"LICENSE"
],
"keywords": [
"jss",
"style",
"sheet",
"stylesheet",
"css",
"components",
"composable",
"css in js",
"css-in-js"
],
"scripts": {
"build": "node ../../scripts/build.js",
"check-snapshot": "node ../../scripts/match-snapshot.js"
},
"dependencies": {
"jss": "^9",
"jss-plugin-cache": "^3",
"jss-plugin-isolate": "^5",
"jss-preset-default": "^4"
}
}
67 changes: 67 additions & 0 deletions packages/jss-starter-kit/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# jss-starter-kit:🚰 the whole kitchen sink

[![Gitter](https://badges.gitter.im/JoinChat.svg)](https://gitter.im/cssinjs/lobby)

The `jss-starter-kit` combines all of the other [packages](https://github.com/cssinjs/jss/tree/master/packages) into a single bundle, to make it easy to import directly into a playground like Codepen, or a local HTML file.

:warning: This bundle includes every JSS package, unminified. It's great for experimenting, but not suitable for production deployment.

## Quick start

There's an instance of JSS already set up with all of the default plugins, exported as `jss`.

```javascript
import {jss} from 'https://unpkg.com/jss-starter-kit'

// Notice that you can use camel-cased style keys here, because
// the default preset include jss-plugin-syntax-camel-case. If you want to use
// jss in your production application, you'll need to manually install the
// plugins you need.
const {classes} = jss
.createStyleSheet({
wrapper: {
padding: 40,
background: '#f7df1e',
textAlign: 'center'
},
title: {
font: {
size: 40,
weight: 900
},
color: '#24292e'
},
link: {
color: '#24292e',
'&:hover': {
opacity: 0.5
}
}
})
.attach()

document.body.innerHTML = `
<div class="${classes.wrapper}">
<h1 class="${classes.title}">Hello JSS!</h1>
<a
class=${classes.link}
href="http://cssinjs.org/"
traget="_blank"
>
See docs
</a>
</div>
`
```

## Plugins

[Every plugin shipped by JSS](https://github.com/cssinjs/jss/tree/master/packages) is included here. See [`index.js`](https://github.com/cssinjs/jss/blob/master/packages/jss-starter-kit/src/index.js) to see the names they are exported as.

## Issues

File a bug against [cssinjs/jss prefixed with \[jss-starter-kit\]](https://github.com/cssinjs/jss/issues/new?title=[jss-starter-kit]%20).

## License

MIT
28 changes: 28 additions & 0 deletions packages/jss-starter-kit/src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// @flow
import jss from 'jss'
import preset from 'jss-preset-default'

console.warn(`The JSS Starter Kit is for learning and experimentation. It's not optimized for production deployment.
If you'd like to JSS in production, try using the "jss" and "jss-preset-default" bundles directly. See an example at https://github.com/cssinjs/jss#example`)

jss.setup(preset())

export {default as jss} from 'jss'
export {default as preset} from 'jss-preset-default'
export {default as functions} from 'jss-plugin-syntax-rule-value-function'
export {default as observable} from 'jss-plugin-syntax-rule-value-observable'
export {default as template} from 'jss-plugin-syntax-template'
export {default as global} from 'jss-plugin-syntax-global'
export {default as extend} from 'jss-plugin-syntax-extend'
export {default as nested} from 'jss-plugin-syntax-nested'
export {default as compose} from 'jss-plugin-syntax-compose'
export {default as camelCase} from 'jss-plugin-syntax-camel-case'
export {default as defaultUnit} from 'jss-plugin-syntax-default-unit'
export {default as expand} from 'jss-plugin-syntax-expand'
export {default as vendorPrefixer} from 'jss-plugin-vendor-prefixer'
export {default as propsSort} from 'jss-plugin-props-sort'
export {default as isolate} from 'jss-plugin-isolate'
export {default as cache} from 'jss-plugin-cache'

export default jss
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ If you are a Sass (SCSS) user, this course will show how to express popular Sass
## Example

Try it out on [playground](https://codesandbox.io/s/z21lpmvv33).
You need to [setup plugins](docs/setup.md#setup-with-plugins) before.
You can use a [preset](https://github.com/cssinjs/jss-preset-default) for a quick setup with default plugins.
You need to [setup plugins](docs/setup.md#setup-with-plugins) first.
You can use a [preset](https://github.com/cssinjs/jss-preset-default) for a quick setup with default plugins, or try [`jss-starter-kit`](packages/jss-starter-kit) for easy experimentation..

```javascript
import jss from 'jss'
Expand Down
12 changes: 8 additions & 4 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ const getBabelOptions = ({useESModules}) => ({
})

const commonjsOptions = {
ignoreGlobal: true
ignoreGlobal: true,
// The CommonJS plugin can't resolve the exports in `react` automatically.
// https://github.com/rollup/rollup-plugin-commonjs#custom-named-exports
// https://github.com/reduxjs/react-redux/issues/643#issuecomment-285008041
namedExports: {
react: ['Component']
}
}

const snapshotOptions = {
Expand Down Expand Up @@ -146,11 +152,9 @@ export default [
commonjs(commonjsOptions),
nodeGlobals({process: false}),
replace({
'process.env.NODE_ENV': JSON.stringify('development'),
'process.env.VERSION': JSON.stringify(pkg.version)
})
// sizeSnapshot barfs with
// [!] (size-snapshot plugin) Error: Error transforming bundle with 'size-snapshot' plugin: ModuleNotFoundError: Module not found: Error: Can't resolve 'jss/node_modules/rollup-plugin-size-snapshot/node_modules/webpack/buildin/harmony-module.js' in '/'
// sizeSnapshot(snapshotOptions),
]
}
]

0 comments on commit 64d855a

Please sign in to comment.