Skip to content

Instantly share code, notes, and snippets.

@gregturn
Created April 8, 2015 17:57
Show Gist options
  • Select an option

  • Save gregturn/ed71c6f6a8c1efa6ae74 to your computer and use it in GitHub Desktop.

Select an option

Save gregturn/ed71c6f6a8c1efa6ae74 to your computer and use it in GitHub Desktop.
CSS and SASS inside gradle
import org.apache.tools.ant.taskdefs.condition.Os
apply plugin: 'java'
apply plugin: 'com.github.robfletcher.compass'
jar {
from 'dist'
eachFile { details ->
details.path = details.path.startsWith('META-INF') ?: 'static/'+details.path
}
// Jar contains duplicate empty folders, see Gradle issue:
// http://issues.gradle.org/browse/GRADLE-1830
// so we need to set includeEmptyDirs to false
includeEmptyDirs = false
}
task npmInstall(type:Exec) {
// be Gradle-like and suppress boilerplate logging
logging.captureStandardOutput LogLevel.INFO
// but we do always want to see downloads in the log
logging.captureStandardError LogLevel.LIFECYCLE
inputs.files "package.json", "bower.json"
outputs.dir "node_modules"
if(Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'cmd', '/c', 'npm', 'install'
} else {
commandLine 'npm', 'install'
}
}
task npmBuild(dependsOn: npmInstall, type:Exec) {
logging.captureStandardOutput LogLevel.INFO
logging.captureStandardError LogLevel.INFO
inputs.dir "src"
inputs.file "gulpfile.js"
outputs.dir "dist"
if(Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'cmd', '/c', 'npm', 'run', 'build'
} else {
commandLine 'npm', 'run', 'build'
}
}
task npmSass(dependsOn: npmBuild, type:Exec) {
logging.captureStandardOutput LogLevel.INFO
logging.captureStandardError LogLevel.INFO
}
jar.dependsOn npmBuild
idea.module {
// see .gitignore
excludeDirs += [
file('dist'),
file('src/lib'),
file('node_modules')
]
}
compass {
cssDir = file("dist/css-new")
sassDir = file("src/sass")
}
dependencies {
jrubyExec group: 'rubygems', name: 'sass-css-importer', version: '1.0.0.beta.0'
}
@import url(CSS:../pui-v1.4.0/pivotal-ui.css);
@import "CSS:../pui-v1.4.0/pivotal-ui.css";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment