Code Monkey home page Code Monkey logo

sbt-webpack's Introduction

sbt-webpack

An sbt-web plugin for the webpack module bundler.

Add plugin

Add the plugin to project/plugins.sbt.

addSbtPlugin("com.github.stonexx.sbt" % "sbt-webpack" % "1.0.8")

Your project's build file also needs to enable sbt-web plugins. For example with build.sbt:

lazy val root = (project.in file(".")).enablePlugins(SbtWeb)

If you want to run the webpack before another task. For example with build.sbt:

WebKeys.pipeline := WebKeys.pipeline.dependsOn(webpack).value

From the sbt console:

  • Run webpack production mode with webpack or webpackProd
  • Run webpack development mode with webpackDev
  • Run webpack testing mode with webpackTest
  • Start watch mode with webpackWatch
  • Stop watch mode with webpackStop

Add webpack as a devDependancy to your package.json file (located at the root of your project):

{
  "devDependencies": {
    "webpack": "^1.14.0"
  }
}

Configuration

WebpackKeys.config in webpack := [location of config file]
WebpackKeys.config in webpackDev := [location of config file for development mode]
WebpackKeys.config in webpackProd := [location of config file for production mode]
WebpackKeys.config in webpackTest := [location of config file for testing mode]

(if not set, defaults to baseDirectory / "webpack.config.js")

You need to set the source filters to include the same resources that are matched by the module loaders. For example:

includeFilter in webpack := "*.js"
includeFilter in webpackDev := "*.js" // for development mode
includeFilter in webpackProd := "*.js" // for production mode
includeFilter in webpackTest := "*.js" // for testing mode

See how to include/exclude files in the source directory for how to configure this setting.

Make sure that this stays in sync with the webpack configuration otherwise sbt will not invalidate the cache and resources will not be regenerated correctly.

License

sbt-webpack is licensed under the Apache License, Version 2.0

sbt-webpack's People

Contributors

kwseok avatar

Watchers

 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.