Giter Site home page Giter Site logo

zhuxindaba / multipage-webpack-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zorigitano/multipage-webpack-plugin

0.0 1.0 0.0 264 KB

A plugin that makes handling templates and asset distribution for multi-page applications using webpack trivial

License: Apache License 2.0

JavaScript 100.00%

multipage-webpack-plugin's Introduction

multipage-webpack-plugin

Build Status Coverage Status

webpack plugin that allows for trivial configuration for multi page web applications

Problem

Currently to architect a webpack configuration for multi page web applications, there are many requirements for managing all assets and entry points.

  • In a multipage application every rendered page corresponds to a webpack entry point.

  • Each entry point will have some sort of index.html file or a MVC framework specific server template (partial) which renders to html content.

    • May have different paths, may not even be in the same directory as the entry point.
    • Should contain just the assets bundled for that entry.
    • You would have to create essentially a html-webpack-plugin for each entry however posses extra configuration challenges:

    An example for a Laravel 4 Application using Twig Templates

    const templatesFn = (modules, twigRoot, assetsRoot, shared) => {
      return Object.keys(modules).map((entryName) => {
        return new HtmlWebpackPlugin({
          template: `${assetsRoot}/webpack.template.hbs`, //path.resolve(__dirname, "./assets/webpack.template.hbs"),
          filename: `${twigRoot}/webpack-bundles/${entryName}.twig`,
          chunks: ['inline', 'vendors', entryName, `${shared}`]
        })
      });
    } 
    

Development

  • npm install

Single Test Build

  • npm t

Test Watch

  • npm run test:watch

Usage [WIP]

Plugin Options [WIP]

sharedChunkName vendorChunkName inlineChunkName templateFilename templatePath htmlTemplatePath

multipage-webpack-plugin's People

Contributors

thelarkinn avatar zorigitano avatar suhasdeshpande avatar mikebautista avatar pvande 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.