GithubHelp home page GithubHelp logo

isabella232 / wro4j-gradle-plugin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from wro4j/wro4j-gradle-plugin

0.0 0.0 0.0 134 KB

Gradle Wro4j Plugin

License: Apache License 2.0

Java 5.23% Groovy 58.58% CSS 35.89% JavaScript 0.26% HTML 0.04%

wro4j-gradle-plugin's Introduction

Wro4J Gradle Plugin

Provides build-time solution for wro4j with Gradle.

Latest release: 1.8.0.Beta4

Getting Started

You could find complete example here

Step 1. Layout your web sources

Put your web sources (html, js, css, less, etc) in the following folders:

src/
  main/
    webResources/
      js/
        *.js
      themes/
        default/
          images/
            *.png; *.gif; ...
          *.css; *.less; ...
      static/
        index.html; ...

Plugin treats all paths against $projectDir/src/main/webResources. Files from static folder will be copied to output as is by default but for js and css it is necessary to provide bundle configuration (see step 4).

Step 2. Apply plugin

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'ro.isdc.wro4j.gradle:wro4j-gradle-plugin:1.8.0.Beta4'
    }
}
apply plugin: 'java'
apply plugin: 'wro4j'

Wro4J plugin requires Java plugin to be applied first.

Step 3. Add webjar dependencies

dependencies {
    webjars 'org.webjars:jquery:2.1.4'
    webjars 'org.webjars:bootstrap:3.3.4'
}

Step 4. Define bundles

webResources {
    bundle ('core') {
        js 'js/**/*.js'
        preProcessor 'jsMin'
    }

    bundle ('libs') {
        js 'webjars/jquery/2.1.4/jquery.min.js'
    }

    bundle ('theme-default') {
        css 'webjars/bootstrap/3.3.4/less/bootstrap.less'
        css 'themes/default/main.css'

        cssOverrideImport 'variables.less', '../../../../themes/default/variables.less'
        preProcessor 'less4j', 'cssUrlRewriting'
    }

    assets {
        include 'themes/default/images/**'
    }
}

You could reference webjar's content just using webjars/ prefix, e.g. webjars/bootstrap/3.3.4/less/bootstrap.less.

Step 5. Build

gradlew build

When build finished you will get a jar with the following resources:

static/
  themes/
    default/
      images/
        *.png; *.gif; ...
    core.js
    libs.js
    theme-default.css
    index.html; ...

wro4j-gradle-plugin's People

Contributors

ilyaai avatar musketyr 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.