diff options
Diffstat (limited to 'juick-www')
-rw-r--r-- | juick-www/build.gradle | 57 | ||||
-rw-r--r-- | juick-www/package.json | 22 | ||||
-rw-r--r-- | juick-www/src/main/static/scripts.js (renamed from juick-www/src/main/webapp/scripts.js) | 0 | ||||
-rw-r--r-- | juick-www/src/main/static/style.css (renamed from juick-www/src/main/webapp/style.css) | 0 | ||||
-rw-r--r-- | juick-www/webpack.config.js | 25 |
5 files changed, 58 insertions, 46 deletions
diff --git a/juick-www/build.gradle b/juick-www/build.gradle index 1cfab4af..f09abb3a 100644 --- a/juick-www/build.gradle +++ b/juick-www/build.gradle @@ -4,16 +4,21 @@ buildscript { jcenter() } dependencies { - classpath 'com.eriwen:gradle-css-plugin:1.11.1' - classpath 'com.eriwen:gradle-js-plugin:1.12.1' classpath 'com.tkruse.gradle:gradle-groovysh-plugin:1.0.8' } } + +plugins { + id "com.moowork.node" version "0.13" +} + +task compileFrontend(type: NpmTask) { + args = ['run', 'compile'] +} + apply plugin: 'java' apply plugin: 'war' -apply plugin: 'css' apply plugin: 'org.akhikhl.gretty' -apply plugin: 'com.eriwen.gradle.js' apply plugin: 'com.github.tkruse.groovysh' repositories { @@ -36,48 +41,8 @@ dependencies { providedRuntime 'mysql:mysql-connector-java:5.1.39' } -javascript.source { - dev { - js { - srcDir "src/main/webapp" - include "*.js" - } - } -} - -combineJs { - source = javascript.source.dev.js.files - dest = file("${buildDir}/scripts.all.js") -} - -minifyJs { - source = combineJs - dest = file("${buildDir}/scripts.min.js") - sourceMap = file("${buildDir}/scripts.sourcemap.json") -} - -css.source { - dev { - css { - srcDir "src/main/webapp" - include "*.css" - } - } -} - -combineCss { - source = css.source.dev.css.files - dest = "${buildDir}/style.all.css" -} - -minifyCss { - source = combineCss - dest = "${buildDir}/style.min.css" -} - -assemble.dependsOn 'minifyCss' -assemble.dependsOn 'minifyJs' - +compileFrontend.dependsOn 'npmInstall' +war.dependsOn 'compileFrontend' compileJava.options.encoding = 'UTF-8' gretty { diff --git a/juick-www/package.json b/juick-www/package.json new file mode 100644 index 00000000..833707b4 --- /dev/null +++ b/juick-www/package.json @@ -0,0 +1,22 @@ +{ + "name": "juick", + "version": "1.0.0", + "private": true, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1", + "compile": "webpack --colors -p" + }, + "repository": { + "type": "git", + "url": "https://github.com/juick/juick.git" + }, + "license": "AGPLv3", + "devDependencies": { + "css-loader": "^0.23.1", + "expose-loader": "^0.7.1", + "extract-text-webpack-plugin": "^1.0.1", + "globby": "^4.1.0", + "style-loader": "^0.13.1", + "webpack": "^1.13.1" + } +} diff --git a/juick-www/src/main/webapp/scripts.js b/juick-www/src/main/static/scripts.js index 93594f71..93594f71 100644 --- a/juick-www/src/main/webapp/scripts.js +++ b/juick-www/src/main/static/scripts.js diff --git a/juick-www/src/main/webapp/style.css b/juick-www/src/main/static/style.css index 5548b79a..5548b79a 100644 --- a/juick-www/src/main/webapp/style.css +++ b/juick-www/src/main/static/style.css diff --git a/juick-www/webpack.config.js b/juick-www/webpack.config.js new file mode 100644 index 00000000..d72c23e5 --- /dev/null +++ b/juick-www/webpack.config.js @@ -0,0 +1,25 @@ +var webpack = require("webpack") +var globby = require("globby") +var ExtractTextPlugin = require("extract-text-webpack-plugin") +module.exports = { + entry: { + "scripts" : globby.sync([ + __dirname + "/src/main/static/*.*" + ]) + }, + output: { + path: __dirname + "/src/main/webapp", + filename: "[name].js" + }, + module: { + loaders: [ + { test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader") }, + { test: /scripts\.js$/, exclude: /node_modules/, loader: "expose?Juick" }, + ] + }, + plugins: [ + new ExtractTextPlugin("style.css", { + allChunks: true + }) + ] +}
\ No newline at end of file |