Package Exports
- one-loader
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (one-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
One Loader
A webpack loader to enable single-file React components.
Inspired by vue-loader.
Installation
$ npm i one-loaderExample
In webpack.config.js:
{
module: {
loaders: [
{
test: /\.one$/,
loader: 'one-loader',
options: {
map: {
'text/css': 'style-loader!css-loader',
'javascript': 'babel-loader'
}
}
}
]
}
}In ExampleComponent.one:
<style>
html {
background-color: green;
}
.basicExample {
color: white;
}
</style>
<script>
export default () => {
return <div className="basicExample">
Hello World
</div>
}
</script>Tips
Use .babelrc and postcss.config.js files to configure respective loaders.
Roadmap
- Extract CSS into separate file abilities
- Scoped styling with css-loader
- Styling with CSS Modules
- Live Reloading
- React Native and SSR support via CSS2JS
License
MIT