From df87d480694fa573d04961719c3486e61fcb4f66 Mon Sep 17 00:00:00 2001 From: HerrHase Date: Tue, 27 Aug 2024 13:01:38 +0200 Subject: [PATCH] update --- README.md | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- index.js | 2 +- 2 files changed, 73 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 53dfa50..ca01481 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,26 @@ module.exports = tinyComponentsWebpack({ }) ``` +## Options + +### destination + ``` -const tinyComponentsWebpack = require('@tiny-components/webpack') +module.exports = tinyComponentsWebpack({ + +}, { + destination: path.resolve(process.cwd(), '../../') +}) +``` + +### svg + +Path to svgs to bundle them with "svg-spritemap-webpack-plugin" to get a +single file, +``` module.exports = tinyComponentsWebpack({ - critical: [ './resources/js/critical.js' ], - styles: [ './resources/scss/styles.scss' ], + }, { svg: { src: [ @@ -26,12 +40,67 @@ module.exports = tinyComponentsWebpack({ }) ``` +### context + +Working Directory for Webpack, + +``` +module.exports = tinyComponentsWebpack({ + +}, { + context: path.resolve(process.cwd(), '../') +}) +``` + +### publicPath + +Name of the Public Path, default is set to '/', + +``` +module.exports = tinyComponentsWebpack({ + +}, { + publicPath: '/public/' +}) +``` + +### purge:src + +Directory for find css-classes in files, + +``` +module.exports = tinyComponentsWebpack({ + +}, { + purge: { + src: path.join(__dirname, 'resources/js') + } +}) +``` + +### purge:src + +Lists of Regex to ignore css-classes, + +``` +module.exports = tinyComponentsWebpack({ + +}, { + purge: { + safelist: { + deep: [ /tiny-datepicker/, /toast/ ] + } + } +}) +``` + ## Plugin: Riot.js For using Riot.js, install compiler and webpack-loader ``` npm install @riotjs/compiler @riotjs/webpack-loader --save-dev +bun add @riotjs/compiler @riotjs/webpack-loader --dev ``` And adding a rule for Riot.js, diff --git a/index.js b/index.js index 6a2bd7c..a6c4e52 100644 --- a/index.js +++ b/index.js @@ -28,7 +28,7 @@ module.exports = function tinyComponentsWebpack(files, options = {}) { } }, options) - const config = { + const config = { context: defaults.context, entry: files, output: {