Permalink
Browse files

Added conditional compilation of css and javascript to compile event

handler.
Moved sass and js source files.
  • Loading branch information...
1 parent 7649aaa commit 0bd9a32e7ce02702f8670b09f85139e123652848 @CarlosZ committed Jul 26, 2011
View
@@ -1,5 +1,4 @@
target/*
isolda.iws
.sass-cache/*
-web-app/css/*
stacktrace.log
View
@@ -1,5 +1,5 @@
({
- baseUrl: "./src/javascript",
+ baseUrl: "./web-app/js/src/",
dir: "web-app/js/pkg/",
optimizeCss: "none",
modules: [
View
@@ -2,8 +2,8 @@
# Set this to the root of your project when deployed:
http_path = "/"
-css_dir = "web-app/css"
-sass_dir = "src/stylesheets"
+css_dir = "web-app/css/pkg"
+sass_dir = "web-app/css/src"
images_dir = "images"
javascripts_dir = "javascripts"
@@ -3,8 +3,8 @@
<html>
<head>
<title><g:layoutTitle default="Grails"/></title>
- <link href="${resource(dir: 'css', file: 'screen.css')}" media="screen, projection" rel="stylesheet" type="text/css"/>
- <link href="${resource(dir: 'css', file: 'print.css')}" media="print" rel="stylesheet" type="text/css"/>
+ <link href="${resource(dir: 'css/pkg', file: 'screen.css')}" media="screen, projection" rel="stylesheet" type="text/css"/>
+ <link href="${resource(dir: 'css/pkg', file: 'print.css')}" media="print" rel="stylesheet" type="text/css"/>
<link rel="shortcut icon" href="${resource(dir: 'images', file: 'favicon.ico')}" type="image/x-icon"/>
<g:layoutHead/>
<g:if test="Environment.current == Environment.DEVELOPMENT">
@@ -21,8 +21,9 @@
alt="${message(code: 'spinner.alt', default: 'Loading...')}"/>
</div>
-<div id="grailsLogo"><a href="http://grails.org"><img src="${resource(dir: 'images', file: 'grails_logo.png')}"
- alt="Grails" border="0"/></a></div>
+<div id="grailsLogo">
+ <a href="http://grails.org"><img src="${resource(dir: 'images', file: 'grails_logo.png')}" alt="Grails" border="0"/></a>
+</div>
<g:layoutBody/>
</body>
</html>
@@ -1,19 +1,42 @@
eventCompileStart = {
- def requireJsDir = "${grailsSettings.baseDir}/lib/require-optimize"
- ant.path(id: "rhinoClasspath") {
- fileset(dir: requireJsDir, includes: "*.jar")
+ // Compile javascript
+ def jsBaseDir = "${grailsSettings.baseDir}/web-app/js"
+ ant.uptodate(property: "jsIsUptodate", value: false, targetfile: "${jsBaseDir}/pkg/main.js") {
+ srcfiles(dir: "${jsBaseDir}/src/", includes: "**/*.js")
}
- ant.java(classname: "org.mozilla.javascript.tools.shell.Main", classpathref: "rhinoClasspath") {
- arg(value: "${requireJsDir}/r.js")
- arg(value: "-o")
- arg(value: "${grailsSettings.baseDir}/buildconfig.js")
+ if (!ant.project.properties.jsIsUptodate) {
+ println "\n ** Compiling Javascript."
+
+ def requireJsDir = "${grailsSettings.baseDir}/lib/require-optimize"
+ ant.path(id: "rhinoClasspath") {
+ fileset(dir: requireJsDir, includes: "*.jar")
+ }
+
+ ant.java(classname: "org.mozilla.javascript.tools.shell.Main", classpathref: "rhinoClasspath", failonerror: true) {
+ arg(value: "${requireJsDir}/r.js")
+ arg(value: "-o")
+ arg(value: "${grailsSettings.baseDir}/buildconfig.js")
+ }
+ } else {
+ println "\n ** Javascript is up-to-date, not compiling."
}
-}
-// Allow tomcat to follow symlinks
-eventConfigureTomcat = { tomcat ->
- def ctx = tomcat.host.findChild(serverContextPath)
- ctx.allowLinking = true
+ def cssBaseDir = "${grailsSettings.baseDir}/web-app/css"
+
+ ant.uptodate(property: "cssIsUptodate", value: false, targetfile: "${cssBaseDir}/pkg/screen.css") {
+ srcfiles(dir: "${cssBaseDir}/src/", includes: "**/*.scss")
+ }
+
+ if (!ant.project.properties.cssIsUptodate) {
+ println "\n ** Compiling CSS."
+
+ ant.exec(executable: "compass") {
+ arg(value: "compile")
+ }
+ } else {
+ println "\n ** CSS is up-to-date, not compiling."
+ }
}
+
View
@@ -1 +1,2 @@
js/pkg/*
+css/pkg/*
@@ -0,0 +1,5 @@
+/* Welcome to Compass. Use this file to write IE specific override styles.
+ * Import this file using the following HTML or equivalent:
+ * <!--[if IE]>
+ * <link href="/stylesheets/ie.css" media="screen, projection" rel="stylesheet" type="text/css" />
+ * <![endif]--> */
@@ -0,0 +1,118 @@
+$primary-font: verdana, arial, helvetica, sans-serif;
+$body-font-size: 11px;
+
+$background-color: #ffffff;
+$primary-color: #333333;
+$secondary-color: #666666;
+$title-color: #48802C;
+
+// General Elements
+
+body {
+ background: $background-color;
+ color: $primary-color;
+ font-size: $body-font-size;
+ font-family: $primary-font;
+}
+
+a {
+ &:link, &:visited, &:hover {
+ color: $secondary-color;
+ font-weight: bold;
+ text-decoration: none;
+ }
+}
+
+h1 {
+ color: $title-color;
+ font-weight: normal;
+ font-size: 16px;
+ margin: 5px;
+}
+
+ul {
+ padding-left: 15px;
+}
+
+// Inputs
+
+select {
+ padding: 2px;
+}
+
+textarea {
+ width: 250px;
+ height: 150px;
+ vertical-align: top;
+}
+
+input, select, textarea {
+ border: 1px solid $secondary-color;
+ font-family: $primary-font;
+ margin: 2px 0;
+ padding: 2px 4px;
+}
+
+input:focus, select:focus, textarea:focus {
+ border: 1px solid #b2d1ff;
+}
+
+// TABLES
+
+table {
+ border: 1px solid $secondary-color;
+ width: 100%;
+}
+
+tr {
+ border: 0;
+}
+
+td {
+ line-height: 12px;
+ padding: 5px 6px;
+ text-align: left;
+ vertical-align: top;
+}
+
+th {
+ line-height: 12px;
+ padding: 5px 6px;
+ text-align: left;
+ vertical-align: top;
+ background: white url(../images/skin/shadow.jpg);
+ color: #666;
+ font-size: 11px;
+ font-weight: bold;
+ line-height: 17px;
+ padding: 2px 6px;
+ a {
+ &:link, &:visited, &:hover {
+ color: #333;
+ display: block;
+ font-size: 10px;
+ text-decoration: none;
+ width: 100%;
+ }
+ }
+ &.asc a, &.desc a {
+ background-position: right;
+ background-repeat: no-repeat;
+ }
+ &.asc a {
+ background-image: url(../images/skin/sorted_asc.gif);
+ }
+ &.desc a {
+ background-image: url(../images/skin/sorted_desc.gif);
+ }
+}
+
+.odd {
+ background: #f7f7f7;
+}
+
+.even {
+ background: #fff;
+}
+
+
@@ -0,0 +1,3 @@
+/* Welcome to Compass. Use this file to define print styles.
+ * Import this file using the following HTML or equivalent:
+ * <link href="/stylesheets/print.css" media="print" rel="stylesheet" type="text/css" /> */
Oops, something went wrong. Retry.

0 comments on commit 0bd9a32

Please sign in to comment.