Coder Social home page Coder Social logo

nicepack's Introduction

Nicepack

Nicer configuration for Webpack.

What is this all about?

Webpack is a fantasticly powerful tool that lets you build Webpack using some pretty awesome ideas. However, it's configuration is quite 'bare' and complicated for most usages. I think there's opportunity to create some sort of abstraction on top of Webpack to make using it much simpler for most use cases.

Here's the ideal API I'm exploring at the moment:

const webpackConfig = new Nicepack()
  .root('./src')
  .entry('app/index.js')
  .use(babel())
  .use(cssModules(stylus()));

This represents one approach for how to do that. I don't know whether this is good or not, so I'm just exploring this idea to see where it goes. The biggest concern I have with this is requiring custom 'plugins' (which are really just super thin wrappers around existing Webpack loaders/plugins) that would need to be developed and maintained.

One workaround for this is also expose an API on Nicepack to add configurations manually. For example:

const webpackConfig = new Nicepack()
  .entry('./src/app/index.js')
  .use(babel())

  // Exposes a way to add loaders manually
  .loader({
    test: /\.css$/,
    loaders: ['style', 'css', 'stylus'],
  })

  // We could also take this as an opportunity to 'improve' the loader config api
  .loader('css', [
    'style',
    {css: { modules: true }},
    'stylus'
  ])

  // Provide an 'escape hatch' to get access to the underlying webpack config
  // so you can make any modifications to it
  .config

What's done already?

Massive work in progress, nothing really here yet.

Files of interest:

  • index.js: Main implementation of Nicepack. This is what end-users consume.
  • usage.js: Example usage of Nicepack. This is what end-users would write and shows how to use Nicepack
  • plugins.js: Demonstrates how to create plugins for Nicepack

nicepack's People

Contributors

joshhunt avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  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.