0.8.2 • Published 5 years ago

yanrong-sunny-builder v0.8.2

Weekly downloads
2
License
GNU
Repository
github
Last release
5 years ago

sunny-builder

A tools for front-end workflow

It is developing. Don't use it in large scale project. Welcome submit issues.

The builder is based on webpack. It contains a series of common plugins and loader and you can write es2015 code directly. It can help you distinguish between dev, build and dist scene. It recommands you to use webpack in the whole development process. And you can use other webpack loaders and plugins without any districts.

Scene Concept

  • dev: For development. The builder will watch your code, compile them when they are changed and then refresh the browser.
  • build: Package the project without compress and uglify.
  • dist: For production. Package the project, compress the images and uglify the code.

Install

install the builder in global.

npm install -g sunny-builder

Get Started

  1. create a sun.config.js under the project root.

    var path = require('path');
    
    module.exports = {
        webpack: {
            entry: {
                home: ['./public/modules/home/home.js']
            },
            output: {
                path: path.join(__dirname, 'build'),
                publicPath: ''
            }
        },
        pageMap: [
            {
                chunks: ['home'],
                template: './templates/views/index.twig',
                filename: 'index.twig'
            }
        ]
    };
  2. Install dependencies.

    sun install
  3. Start developing.

    sun dev