Giter Club home page Giter Club logo

ratpack-asset-pipeline's Introduction

Ratpack Asset-Pipeline

This module provides runtime for both development and production to the Ratpack framework for rendering files compiled by Asset-Pipeline. This should be paired with the asset-pipeline-gradle plugin appropriately

NOTE: Version 2.3.0 has resulted in a change of config and asset location. Please read the documentation below if needing to upgrade.

buildscript {
  repositories {
    jcenter()
    mavenCentral()
  }
  dependencies {
    classpath 'com.bertramlabs.plugins:asset-pipeline-gradle:2.4.3'
    //Example additional LESS support
    //classpath 'com.bertramlabs.plugins:less-asset-pipeline:2.3.0'
  }
}

apply plugin: 'asset-pipeline'

dependencies {
	compile 'com.bertramlabs.plugins:ratpack-asset-pipeline:2.4.3'
	//Example additional LESS support
    //provided 'com.bertramlabs.plugins:less-asset-pipeline:2.3.0'
}

Also add the Module to your registry

import asset.pipeline.ratpack.AssetPipelineModule;

bindings {
  module new AssetPipelineModule()
}

Or if you want to configure the module

import asset.pipeline.ratpack.AssetPipelineModule;
import ratpack.config.ConfigData;

bindings {
  ConfigData configData = ConfigData.of().sysProps().build()
    moduleConfig(new AssetPipelineModule(), configData.get(AssetPipelineModule.Config))
}

Now you could for example change the less compiler mode with the system property -Dratpack.assets.less.compiler=standard

In your src/assets folder create organizational subfolders i.e. src/assets/javascripts or src/assets/stylesheets.

You can reference these files in your html templates via /assets/application.js. The md5 url replacement work is still in progress as Ratpack spec gets finalized.

Serving from Custom Mapping

You can optionally add this handler to your handler chain and give it a prefix path to filter for on assets. For example, if you want the asset-pipeline to serve assets at the root level simply do this:

import asset.pipeline.ratpack.AssetPipelineHandler;

handlers {
  bindings { ... } //Dont forget to still register the module
  get {
    render groovyMarkupTemplate("index.gtpl", title: "My Ratpack App")
  }

  all(AssetPipelineHandler)
}

Things to be Done

  • Url replacements for templates
  • Testing

ratpack-asset-pipeline's People

Contributors

davydotcom avatar danveloper avatar

Watchers

Marcin Erdmann avatar James Cloos 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.