Learn how to include Campo UI in your project using Webpack.
$ npm install campo-ui
or
$ yarn add campo-ui
Add this content to webpack config:
module: {
rules: [
{
test: /\.css$/,
use: ['style-loader', 'css-loader']
}
]
}
It enabled webpack to process css.
Then add this content to entry file:
import 'campo-ui/dist/css/campo-ui.css'
Then add this content to entry file:
import 'campo-ui/dist/js/campo-ui.bundle.js'
If you are using stimulus, use this content to get stimlus application:
// required stimulus installed
import { definitionsFromContext } from "stimulus/webpack-helpers"
import { application } from 'campo-ui/dist/js/campo-ui.js'
const context = require.context("./controllers", true, /\.js$/)
application.load(definitionsFromContext(context))