reacton-loader

2.2.23 • Public • Published

reacton-loader

Loader for single-file Reacton components in Webpack

Install

npm i reacton-loader -D

A fragment of the working project is shown below:

webpack.config.js

module: {
  rules: [
    {
      test: /\.htm$/,
      loader: 'reacton-loader',
    },
    ... // other rules
  ]
},

Mixins.js

export default class {
  getStringInUpperCase(str) {
    return str.toLocaleUpperCase()
  }
}

MyComponent.htm

<my-component>
  <h1>Hello, {{ getStringInUpperCase(message) }}!</h1>
        
  <style>
    h1 {
      color: {{ color }};
    }
  </style>

  <script>
    import Mixins from '../Mixins'

    exports = class extends Mixins {
      constructor(props) {
        super()
        this.message = 'Reacton'
        this.color = props.color
      }

      static mode = 'open' // add Shadow DOM
    }
  </script>
</my-component>

Package Sidebar

Install

npm i reacton-loader

Weekly Downloads

5

Version

2.2.23

License

MIT

Unpacked Size

83.4 kB

Total Files

52

Last publish

Collaborators

  • reacton