@tiny-components/webpack (0.5.1)

Published 4 months ago by HerrHase

Installation

@tiny-components:registry=https://git.node001.net/api/packages/tiny-components/npm/
npm install @tiny-components/webpack@0.5.1
"@tiny-components/webpack": "0.5.1"

About this package

Webpack

Small Wrapper Function for using Webpack. These Function is only Build to using,

const tinyComponentsWebpack = require('@tiny-components/webpack')

module.exports = tinyComponentsWebpack({
    critical: [ './resources/js/index.js' ],
    styles: [ './resources/scss/styles.scss' ],
})

Options

destination

module.exports = tinyComponentsWebpack({
    <files>
}, {
    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({
    <files>
}, {
    svg: {
        src: [ 
            './resources/icons/*.svg'
        ]
    }
})

context

Working Directory for Webpack,

module.exports = tinyComponentsWebpack({
    <files>
}, {
    context: path.resolve(process.cwd(), '../')
})

publicPath

Name of the Public Path, default is set to '/',

module.exports = tinyComponentsWebpack({
    <files>
}, {
    publicPath: '/public/'
})

purge:src

Directory for find css-classes in files,

module.exports = tinyComponentsWebpack({
    <files>
}, {
    purge: {
        src: path.join(__dirname, 'resources/js')
    }
})

purge:src

Lists of Regex to ignore css-classes,

module.exports = tinyComponentsWebpack({
    <files>
}, {
    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,

const tinyComponentsWebpack = require('@tiny-components/webpack')
const riotPlugin = require('@tiny-components/webpack/rules/riot')

module.exports = tinyComponentsWebpack({
    critical: [ './resources/js/critical.js' ], 
    styles: [ './resources/scss/styles.scss' ],
}, {
    rules: [ riotRules ]
})

Dependencies

Dependencies

ID Version
css-loader ^6.10.0
mini-css-extract-plugin ^2.8.1
purgecss-webpack-plugin ^5.0.0
sass ^1.71.1
sass-loader ^14.1.1
svg-spritemap-webpack-plugin ^4.5.0
webpack ^5.90.3
webpack-cli ^5.1.4
webpack-remove-empty-scripts ^1.0.4
Details
npm
4 months ago
12
Björn Hase
MIT
3.6 KiB
Assets (1)
Versions (7) View all
0.5.2 on 2024-09-08
0.5.1 on 2024-08-28
0.5.0 on 2024-08-27
0.4.0 on 2024-08-17
0.3.0 on 2024-03-20