Skip to content

Latest commit

 

History

History
106 lines (79 loc) · 4.2 KB

README.md

File metadata and controls

106 lines (79 loc) · 4.2 KB

Asset Pipeline for Grace

Grace CI Apache 2.0 license Latest version on Maven Central Grace on X

Groovy Version Grace Version Spring Boot Version

Important

This repository is a fork of Asset-Pipeline, developed to support Grace only. Since Grails does not currently support Spring Boot 3.0+, this plugin does not support Grails 5/6.

Overview

The Asset-Pipeline is a plugin used for managing and processing static assets in Grace applications primarily via Gradle. Asset-Pipeline functions include processing and minification of both CSS and JavaScript files.

Features:

  • Asset Bundling
  • Css Minification / Relative Path assertion
  • Js Minification
  • Js SourceMap Generation
  • File Encoding Support
  • GZIP File Generation
  • Last-Modified Header
  • Cache Digest Names (Creates cache digested names and stores aliases in a manifest.properties)

Gradle Usage

If using gradle, this plugin adds a series of tasks directly to your gradle plugin.

All you have to do is apply plugin: 'org.graceframework.asset-pipeline' after confirming this is in the classpath of your buildscript block. i.e.:

// Example build.gradle file
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "org.graceframework.plugins:asset-pipeline-gradle:VERSION"
    }
}

apply plugin: 'org.graceframework.asset-pipeline'

assets {
    assetsPath = 'app/assets'
    minifyJs = true
    minifyCss = true
    enableSourceMaps = true
    configOptions = [:]
  
    minifyOptions = [
        languageMode: 'ES5',
        targetLanguage: 'ES5', //Can go from ES6 to ES5 for those bleeding edgers
        optimizationLevel: 'SIMPLE'
    ]
  
    includes = []
    excludes = ['**/*.less'] // Example Exclude GLOB pattern

    //for plugin packaging
    packagePlugin = false // Set to true if this is a plugin

    // Can add custom asset locations (directories or individual jar files)
    from '/vendor/lib'
    from '/path/to/file.jar'

    // can be used to customize the hashing of the assets
    digestAlgorithm = 'MD5'
    digestSalt = ''

    enableDigests = true
    skipNonDigests = true
}

dependencies {
    runtimeOnly "org.graceframework.plugins:asset-pipeline-plugin:VERSION"
}

Now that you have your build.gradle files. All you need to do is put files in your projects app/assets/javascripts, app/assets/stylesheets, app/assets/images, or whatever subdirectory you want. When you run gradle assetCompile these files will be processed and output into your build/assets folder by default.

Versions

To make it easier for users to use and upgrade, Plugin adopts a version policy consistent with the Grace Framework.

Plugin Version Grace Version
6.2.x 2023.2.x
6.1.x 2023.1.x
6.0.x 2023.0.x
5.2.x 2022.2.x
5.1.x 2022.1.x
5.0.x 2022.0.x

Links