Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

An implementation of an AssetBundle for use in Dropwizard that allows user configuration.

License

Notifications You must be signed in to change notification settings

bazaarvoice/dropwizard-configurable-assets-bundle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Configurable Assets Bundle for Dropwizard

NOTE: THIS PROJECT IS DEPRECATED. This projects is no longer maintained. It is deprecated for dropwizard-bundles maintained fork. Users of this project should update their project dependencies appropriately.

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

About

An implementation of an AssetBundle for use in Dropwizard that allows user configuration.

Resources

License

Stars

Watchers

Forks

Packages

No packages published