• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

ehirsch/gradle-react-plugin: A simple plugin to use the react-tools to transform ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

ehirsch/gradle-react-plugin

开源软件地址(OpenSource Url):

https://github.com/ehirsch/gradle-react-plugin

开源编程语言(OpenSource Language):

Groovy 100.0%

开源软件介绍(OpenSource Introduction):

Gradle plugin for React

Build Status Download License

This is a very simple Gradle plugin to transform JSX sources into JavaScript. It was inspired by and is using the gradle-node-plugin from Sten Roger Sandvik.

React is

A JAVASCRIPT LIBRARY FOR BUILDING USER INTERFACES

developed at Facebook and Instagram.

Installing the plugin

Releases of this plugin are hosted at BinTray (http://bintray.com) and is part of jcenter repository. Setup the plugin like this:

Gradle versions since 2.1

plugins {
    id 'net.eikehirsch.react' version '0.4.1'
}

Gradle versions below 2.1

buildscript {
	repositories {
		jcenter()
	}
	dependencies {
		classpath 'net.eikehirsch.react:gradle-react-plugin:0.4.1'
	}
}

apply plugin: 'net.eikehirsch.react'

The plugin will also apply gradle-node-plugin for Node and NPM related tasks. (see http://github/srs/gradle-node-plugin for details).

Using the plugin

Simply run

./gradlew jsx

to transform any js file in src/main/react. The resulting files will be stored at build/react.

Configure the plugin

To change the defaults you can put all your settings into the jsx namespace:

jsx {
  sourcesDir = 'src/react'
  destDir    = 'out'
  // optional
  options {
    extension = 'jsx' // js is the default extension
  }
}

Create your own jsx task

You can define the input and output folders without using the extension namespace like this:

task myJSX( type: JSXTask ) {
    sourcesDir = 'src/react'
    destDir = 'out'
    // optional
    options {
        extension = 'js' // js is the default extension
    }
}

(You can try this at the configuration example project)

Include jsx with the build

If you want to have your jsx sources transformed everytime you build your project, you could do something like this:

processResources.dependsOn jsx

// for older gradle versions (e.g. 1.4) use:
processResources.dependsOn 'jsx'

Building the Plugin

To build the plugin, just type the following command:

./gradlew clean build

Acknowledgments




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
jkazama/ddd-java: Spring Boot + Java [ DDD Sample ]发布时间:2022-06-22
下一篇:
fuqile/AndroidBuildGradle: android build.gradle file发布时间:2022-06-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap