Skip to content

Commit

Permalink
Adds gulp and node configuration for Gradle
Browse files Browse the repository at this point in the history
  • Loading branch information
javamind committed Jan 6, 2017
1 parent 2f56c25 commit 672300d
Show file tree
Hide file tree
Showing 9 changed files with 3,645 additions and 10 deletions.
4 changes: 4 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["es2015"],
"retainLines": true
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ build/
.gradle/
classes/
out/
node/
node_modules/

28 changes: 27 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import org.jetbrains.kotlin.noarg.gradle.NoArgExtension
import org.junit.platform.gradle.plugin.EnginesExtension
import org.junit.platform.gradle.plugin.FiltersExtension
import org.junit.platform.gradle.plugin.JUnitPlatformExtension
import com.moowork.gradle.gulp.GulpTask
import com.moowork.gradle.node.NodeExtension
import com.moowork.gradle.node.yarn.YarnInstallTask
import java.util.concurrent.TimeUnit

buildscript {
Expand All @@ -14,13 +17,17 @@ buildscript {
repositories {
mavenCentral()
jcenter()
maven{
setUrl("https://plugins.gradle.org/m2/")
}
}

dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath("org.jetbrains.kotlin:kotlin-noarg:$kotlinVersion")
classpath("com.github.jengelman.gradle.plugins:shadow:1.2.4")
classpath("org.junit.platform:junit-platform-gradle-plugin:$junitPlatformVersion")
classpath("com.moowork.gradle:gradle-node-plugin:1.0.1")
}
}

Expand All @@ -31,6 +38,8 @@ apply {
plugin("application")
plugin("org.junit.platform.gradle.plugin")
plugin("com.github.johnrengelman.shadow")
plugin("com.moowork.node")
plugin("com.moowork.gulp")
}

version = "1.0.0-SNAPSHOT"
Expand Down Expand Up @@ -61,6 +70,11 @@ configure<JUnitPlatformExtension> {
}
}

configure<NodeExtension> {
version = "6.9.2"
download = true
}

fun JUnitPlatformExtension.filters(setup: FiltersExtension.() -> Unit) {
when (this) {
is ExtensionAware -> extensions.getByType(FiltersExtension::class.java).setup()
Expand Down Expand Up @@ -119,4 +133,16 @@ dependencies {
testCompile("org.junit.platform:junit-platform-runner:$junitPlatformVersion")
testCompile("org.jetbrains.spek:spek-api:$spekVersion")
testRuntime("org.jetbrains.spek:spek-junit-platform-engine:$spekVersion")
}
}

task<YarnInstallTask>("yarnInstall"){}

task<GulpTask>("gulpBuild") {
dependsOn("yarnInstall")
getInputs().dir("src/main/sass")
getInputs().dir("build/.tmp")
getOutputs().dir("src/main/static/css")
setArgs(listOf("default"))
}

tasks.getByName("processResources").dependsOn("gulpBuild")
60 changes: 60 additions & 0 deletions gulpfile.babel.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
'use strict';

import gulp from 'gulp';
import gulpLoadPlugins from 'gulp-load-plugins';
import del from 'del';
import runSequence from 'run-sequence';

const $ = gulpLoadPlugins();

const paths = {
main: 'src/main',
tmp: 'build/.tmp',
dist: {
css : 'src/main/resources/static/css'
}
};

// Compile and automatically prefix stylesheets
gulp.task('styles', () => {
const AUTOPREFIXER_BROWSERS = [
'ie >= 10',
'ie_mob >= 10',
'ff >= 30',
'chrome >= 34',
'safari >= 7',
'opera >= 23',
'ios >= 7',
'android >= 4.4',
'bb >= 10'
];

return gulp.src([`${paths.main}/sass/**/*.scss`])
.pipe($.newer(`${paths.tmp}/styles`))
.pipe($.sourcemaps.init())
.pipe($.sass())
.pipe($.autoprefixer(AUTOPREFIXER_BROWSERS))
.pipe(gulp.dest(`${paths.tmp}/styles`))
.pipe($.if('*.css', $.cssnano()))
.pipe($.size({title: 'styles'}))
.pipe($.sourcemaps.write('./'))
.pipe(gulp.dest(`${paths.dist.css}`));
});


// Clean output directory
gulp.task('clean', () => del([paths.tmp], {dot: true}));

// Watch files for changes
gulp.task('watch', ['default'], () => {
gulp.watch([`${paths.main}/sass/**/*.scss`], ['styles']);
});

// Build production files, the default task
gulp.task('default', ['clean'], cb =>
runSequence(
'styles',
cb
)
);

25 changes: 25 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "mixit",
"version": "1.0.0",
"description": "Site used to manage Mixit conference (Lyon - France)",
"main": "index.js",
"repository": "https://github.com/mix-it/mixit.git",
"license": "MIT",
"devDependencies": {
"babel-core": "^6.0.15",
"babel-plugin-transform-es2015-modules-systemjs": "^6.9.0",
"babel-preset-es2015": "^6.0.15",
"del": "^2.2.2",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.1",
"gulp-cssnano": "^2.1.2",
"gulp-if": "^2.0.2",
"gulp-load-plugins": "^1.4.0",
"gulp-newer": "^1.3.0",
"gulp-sass": "^3.0.0",
"gulp-size": "^2.1.0",
"gulp-sourcemaps": "^1.9.1",
"gulp-uncss": "^1.0.6",
"run-sequence": "^1.2.2"
}
}
11 changes: 2 additions & 9 deletions src/main/resources/static/css/app.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/main/resources/static/css/app.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions src/main/sass/app.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.mixit-menu-lang {
height:18px!important;
width:20px!important;
padding:0!important;
}

.mixit-content {
padding-top: 20px;
}
Loading

0 comments on commit 672300d

Please sign in to comment.