Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit 7ff184f

Browse files
authored
Merge pull request #101 from geotrev/develop
[Version 3.0.0] Release
2 parents ba56bc9 + 43ac072 commit 7ff184f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+2607
-1264
lines changed

.npmignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
.DS_store
2-
yarn-error.log*
32
npm-error.log*
43

54
/build/
6-
/node_modules/
75
/.nyc_output/
86

97
.ruby-version

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ The framework features:
1313
- A flex-grid for layouts
1414
- Styling for common tags: buttons, paragraphs, headers, etc.
1515
- Configuration file to apply core brand styling to all elements, including an option for name-spacing.
16-
- Functional JavaScript components: modals, accordions, etc.
16+
- Functional JavaScript components. Currently includes dropdowns, modals, and accordions.
1717

1818
## Easy setup
1919

@@ -59,7 +59,7 @@ For more details on customizing branding, check out the [Branding](https://under
5959

6060
### NPM / JS modules
6161

62-
Another option is to use the npm package and borrow the modules you need. This is great for webpack where you can tree shake the modules you won't be needing.
62+
Another option is to use the npm package and borrow the modules you need. This is great for webpack where you can choose to import specific components directly.
6363

6464
```sh
6565
$ npm install --save-dev undernet
@@ -70,16 +70,16 @@ Check out the [documentation](https://undernet.io/docs/overview/javascript) to s
7070
Then require or import the dependency in your js, or add it to a script tag in your main layout (see the **Easy setup** method above for script usage).
7171

7272
```js
73+
// import everything
7374
import Undernet from "undernet"
74-
75-
// start all components
7675
Undernet.start()
7776

78-
// or only use a single component, e.g. the Modal:
79-
// NOTE: if you use Undernet.start(), you're effectively doing nothing with this property call
80-
Undernet.Modals.start()
77+
// or import a specific component:
78+
import Modals from "undernet/js/dist/components/modal"
79+
Modals.start()
8180
```
8281

82+
8383
#### React
8484

8585
Undernet fully supports use in React. You simply need to call the `.start()` property in `componentDidMount()`, and then `.stop()` in `componentWillUnmount()` (to prevent unnecessary event listeners when the components are no longer visible):
@@ -96,7 +96,7 @@ export default class SomeComponent extends React.Component {
9696

9797
render() {
9898
return <div>
99-
// ... modal markup here!
99+
{/* ... modal markup here! */}
100100
</div>
101101
}
102102
}
@@ -121,7 +121,7 @@ See CONTRIBUTING.md for more details on git flow and recommendations for pull re
121121

122122
### Fork and clone for development
123123

124-
Clone the repo and re-clone the wiki contents.
124+
First fork the project on Github. Then set up locally.
125125

126126
```sh
127127
$ git clone git@github.com:USER_NAME/undernet.git

babel.config.js

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
1-
function presets(rollup) {
2-
if (rollup) {
3-
return [["@babel/preset-env", { modules: false }]]
4-
} else {
5-
return ["@babel/preset-env", "@babel/preset-react"]
1+
function presets(dist) {
2+
let result = ["@babel/preset-env"]
3+
4+
if (!dist) {
5+
result.pop()
6+
result.push(["@babel/preset-env", { useBuiltIns: "entry" }])
7+
result.push("@babel/preset-react")
68
}
9+
10+
return result
711
}
812

913
function plugins(options) {
10-
let result = ["@babel/plugin-syntax-dynamic-import", "@babel/plugin-proposal-class-properties"]
14+
let result = [
15+
"@babel/plugin-syntax-dynamic-import",
16+
"@babel/plugin-proposal-class-properties",
17+
["babel-plugin-webpack-aliases", { config: "config/webpack.dev.js" }],
18+
]
1119

1220
if (options.test) result.push("dynamic-import-node")
13-
1421
if (options.dev || options.prod) result.push("emotion")
1522

16-
if (options.dev || options.test) {
17-
result.push(["babel-plugin-webpack-aliases", { config: "config/webpack.dev.js" }])
18-
}
19-
2023
return result
2124
}
2225

2326
module.exports = {
2427
env: {
25-
rollup: {
28+
dist: {
2629
presets: presets(true),
2730
},
2831
development: {

config/rollup.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ module.exports = {
2121
resolve(),
2222
babel({
2323
exclude: "node_modules/**",
24+
comments: false,
2425
}),
2526
],
2627
}

config/webpack.prod.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ module.exports = merge(common(true), {
1717
parallel: true,
1818
sourceMap: false,
1919
}),
20-
new OptimizeCSSAssetsPlugin(),
2120
],
2221
runtimeChunk: {
2322
name: "manifest",
@@ -34,6 +33,15 @@ module.exports = merge(common(true), {
3433
allowExternal: true,
3534
}),
3635

36+
// minify styles
37+
new OptimizeCSSAssetsPlugin({
38+
cssProcessorPluginOptions: {
39+
preset: ['default', {
40+
discardComments: { removeAll: true }
41+
}],
42+
},
43+
}),
44+
3745
// create gzip assets
3846
new CompressionPlugin({
3947
test: /\.(js|css)$/,

0 commit comments

Comments
 (0)