Skip to content
This repository was archived by the owner on May 29, 2022. It is now read-only.

Documentation format of each easy-webpack module #35

@Holi0317

Description

@Holi0317

Currently, all easy-webpack modules do not have any documentation. This require users to check source code for each module's function and how to use it. I would like to help with documentation and improve easy-webpack.

Before starting, what should be included in documentation? I can think of the followings.

  • Short description on what the package can do
  • Installation, sample usage and output config
  • Description on each options
  • Related tutorials
  • Tips (if any)

@niieani

Take config-css as example. Here is the sample documentation.

@easy-webpack/config-css

Include and inject css using css-loader and style-loader

Installation

npm install --save-dev @easy-webpack/config-css

easy-webpack is also required.

Usage

// webpack.config.js
const generateConfig = require('@easy-webpack/core').generateConfig;

const baseConfig = { ... }; // project-specific config like the entry file(s)

module.exports = generateConfig(
  baseConfig,

  require('@easy-webpack/config-css')
    ({ filename: 'styles.css', allChunks: true, sourceMap: false })
);

/*
module.exports will be the following:
{
  ...
}
*/

On any JavaScript module, simply import your css file and it will be injected into the DOM globally.

// app.js
require('./style.css')  // CommonJS style import
import './style.css'    // ES Module import

Options

filename

Type: String Default: [name].css

Filename of the extracted css file. Only be used if extractText is not false or undefined.

allChunks

(Other options)

Related tutorials

Tips

Add PostCSS to pipeline

PostCSS is a set of plugins that can transform your CSS.

To add PostCSS install postcss-loader first.

Then, (etc...)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions