Giter Club home page Giter Club logo

dropwizard-configurable-assets-bundle's Introduction

Configurable Assets Bundle for Dropwizard

This GitHub repository contains a drop-in replacement for Yammer's AssetsBundle class that allows for a better developer experience. Developers can use the ConfiguredAssetsBundle class anywhere they would use a AssetsBundle in their Dropwizard applications and take advantage of the ability to specify redirects for URIs to that loads them from disk instead of the classpath. This allows developers to edit browser-interpreted files and reload them without needing to recompile source.

This version is compatible with dropwizard 0.7.X.

Maven Setup

<dependency>
  <groupId>com.bazaarvoice.dropwizard</groupId>
  <artifactId>dropwizard-configurable-assets-bundle</artifactId>
  <version>0.2.2</version>
</dependency>

Getting Started

Implement the AssetsBundleConfiguration:

public class SampleConfiguration extends Configuration implements AssetsBundleConfiguration {
  @Valid
  @NotNull
  @JsonProperty
  private final AssetsConfiguration assets = new AssetsConfiguration();

  @Override
  public AssetsConfiguration getAssetsConfiguration() {
    return assets;
  }
}

Add the redirect bundle:

public class SampleService extends Application<SampleConfiguration> {
    public static void main(String[] args) throws Exception {
        new SampleService().run(args);
    }

    @Override
    public void initialize(Bootstrap<SampleConfiguration> bootstrap) {
        bootstrap.addBundle(new ConfiguredAssetsBundle("/assets/", "/dashboard/"));
    }

    @Override
    public void run(SampleConfiguration configuration, Environment environment) {
        ...
    }
}

A sample local development config:

assets:
  overrides:
    /dashboard: src/main/resources/assets/
  mimeTypes:
    woff: application/font-woff

You can override multiple external folders with a single configuration in a following way:

assets:
  overrides:
    /dashboard/assets: /some/absolute/path/with/assets/
    /dashboard/images: /some/different/absolute/path/with/images

dropwizard-configurable-assets-bundle's People

Contributors

akoskm avatar bbeck avatar bvbuild avatar kubamarchwicki avatar nbauernfeind avatar ohhatiya avatar reason-bv avatar tianx2 avatar

Watchers

 avatar  avatar

Forkers

isabella232

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.