0.0.2-15 • Published 2 years ago
@noths/elements v0.0.2-15
Elements
About
The component library & design system for notonthehighstreet.com
Usage
Using a Component
import { Heading } from '@noths/elements';
<Heading />;
Next JS App SSR Setup + Importing via CDN
- Create custom
_document
file which uses theNothsElementsScript
before any app code.
// _document.js
import { NothsElementsScript } from '@noths/elements';
class MyDocument extends Document {
render() {
return (
<html>
<Head />
<body>
<NothsElementsScript />
<Main />
<NextScript />
</body>
</html>
);
}
}
- Extend next webpack config like so with the
ElementsWebpackPlugin
. This sets@noths/elements
as a webpack external when used in the browser, causing the app to use the library from a CDN.
// next.config.js
const { ElementsWebpackPlugin } = require('@noths/elements');
module.exports = {
webpack: (webpackConfig, { isServer }) => {
return isServer
? webpackConfig
: {
...webpackConfig,
externals: {
react: 'React',
'react-dom': 'ReactDOM',
'styled-components': 'styled',
},
plugins: [].concat(webpackConfig.plugins, new ElementsWebpackPlugin()).filter(Boolean),
};
},
};
Contributing
To contribute and create new components please see CONTRIBUTING.md
.
0.0.2-15
2 years ago
0.0.2-11
3 years ago
0.0.2-10
3 years ago
0.0.2-9
4 years ago
0.0.2-8
4 years ago
0.0.2-7
4 years ago
0.0.2-6
4 years ago
0.0.2-5
4 years ago
0.0.2-4
4 years ago
0.0.2-3
4 years ago
0.0.2-2
4 years ago
0.0.2-1
4 years ago
0.0.2-0
4 years ago
0.0.1
4 years ago
0.0.1-3
4 years ago
0.0.0
4 years ago
0.0.1-2
4 years ago
0.0.1-1
4 years ago
0.0.1-0
4 years ago