Code Monkey home page Code Monkey logo

webpack-boilerplate's Introduction

Webpack 4 Boilerplate

There is Webpack 4 template you can build the project by it.
This Webpack tool is suitable for combination of multiple small projects.

# If you want to know more about this project, please see 快速建置 Webpack 4 常用設定.

Features

  • automatic minify JS, CSS and HTML
  • use preprocessor: babel, scss/sass, postcss & autoprefixer
  • static files use hash filename to avoid the cache
  • use image base64
  • use devServer - hot reload for js, html, css/scss/sass
  • have many custom variables* for CLI, using on the npm scripts
  • auto clean the output folder

# Custom variables: name, entry, template, output, publicPath

Requirements

You only need node.js pre-installed.

Setup

Install plugin dependencies

$ npm install

Development

Run the local webpack-dev-server with livereload.
Auto-compile on http://localhost:8000/ and use the default project app.

$ npm run start

Building project

You can build the default project app by:

$ npm run build

Create new project

  1. Add your folder with the project name, and put it under the basic directory like example.

  2. Add the main JS file (default name: index.js) and HTML template file (default name: index.html).

  3. Add your npm script content on the package.json scripts:

    • On development node, you can write like "dev:example": "webpack-dev-server --mode development --evn.name=example"

    • On production node, you can write like "build:example": "NODE_ENV=production webpack --mode production --evn.name=example"

    • Otherwise you can set --env.{variable}={value} config, there are 5 variables: name, entry, template, output, publicPath. ( see webpack.config.js to get more details )

  4. Start your project coding now.

webpack-boilerplate's People

Contributors

dependabot[bot] avatar visionyi avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.