-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jelte Lagendijk
committed
Nov 26, 2015
1 parent
44b9437
commit 6590388
Showing
4 changed files
with
187 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1 @@ | ||
# Logs | ||
logs | ||
*.log | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directory | ||
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
'use strict'; | ||
|
||
|
||
/* | ||
These variables may be changed | ||
*/ | ||
|
||
// What is the name of the style folder in this theme folder? | ||
var sourceStyleFolder = 'theme/styles'; | ||
// What is the name of the style folder in the deployment folder? | ||
var deploymentStyleFolder = 'styles'; | ||
|
||
// Browsersync feature, please specify the host & port of the running project (without http://) | ||
var proxyAddress = 'localhost:8080'; | ||
|
||
/* | ||
Run this Gruntfile from your project folder as: | ||
> grunt | ||
(default configuration, watches for changes in sass files and copies changes in css files to deployment) | ||
> grunt dev | ||
(dev configuration, does the same as default, but opens a browser in browsersync modus) | ||
************************************************************************* | ||
* Don't try to edit below this line, unless you know what you are doing * | ||
************************************************************************* | ||
*/ | ||
|
||
var path = require('path'), | ||
shelljs = require('shelljs'); | ||
|
||
function getPathFromHere (p) { | ||
return path.join(shelljs.pwd(), p); | ||
} | ||
|
||
var sourceFolder = './' + sourceStyleFolder + '/'; | ||
var deploymentFolder = getPathFromHere('./deployment/web/' + deploymentStyleFolder); | ||
|
||
|
||
module.exports = function (grunt) { | ||
var pkg = grunt.file.readJSON("package.json"); | ||
grunt.verbose; | ||
grunt.initConfig({ | ||
watch: { | ||
sass: { | ||
"files": [ sourceFolder + '**/*.scss' ], | ||
"tasks": [ "sass:dev" ], | ||
options: { | ||
debounceDelay: 250 | ||
} | ||
}, | ||
css: { | ||
"files": [ sourceFolder + '**/*.css' ], | ||
"tasks": [ "copy:dev" ], | ||
options: { | ||
debounceDelay: 250 | ||
} | ||
} | ||
}, | ||
sass: { | ||
dist: { | ||
files: [{ | ||
expand: true, | ||
cwd: 'styles', | ||
src: ['*.scss'], | ||
dest: '../public', | ||
ext: '.css' | ||
}] | ||
}, | ||
dev: { | ||
options: { | ||
style: 'expanded', | ||
compass: true | ||
}, | ||
files: [{ | ||
expand: true, | ||
cwd: sourceFolder, | ||
src: ['*.scss'], | ||
dest: sourceFolder, | ||
ext: '.css' | ||
}] | ||
} | ||
}, | ||
copy: { | ||
dev: { | ||
files: [ | ||
{ | ||
dest: deploymentFolder, | ||
cwd: sourceFolder, | ||
src: ["**/*.css*"], | ||
expand: true | ||
} | ||
] | ||
} | ||
}, | ||
browserSync: { | ||
bsFiles: { | ||
src : [ | ||
deploymentFolder + '/**/*.css' | ||
] | ||
}, | ||
options: { | ||
watchTask: true, | ||
proxy: proxyAddress | ||
} | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-copy') | ||
grunt.loadNpmTasks('grunt-contrib-sass'); | ||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
grunt.loadNpmTasks('grunt-browser-sync'); | ||
|
||
grunt.registerTask("default", "Default task", [ "sass:dev", "watch" ]); | ||
|
||
grunt.registerTask("dev", "BROWSERSYNC", [ "sass:dev", "browserSync", "watch" ]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Gruntfile for Mendix theming | ||
|
||
This Gruntfile makes it easier to develop themes, because you do not have to restart the modeler to see your changes. | ||
|
||
## Prerequisites | ||
|
||
The following things need to be installed: | ||
[Node.js](https://nodejs.org/en/) | ||
[SASS & Compass](http://thesassway.com/beginner/getting-started-with-sass-and-compass) | ||
|
||
## Installation | ||
|
||
1.) Download the latest release (ZIP-file) [here](https://github.com/JelteMX/ux-grunt-theming/releases) | ||
|
||
2.) Unzip in your project root folder | ||
|
||
3.) Open a terminal and go to your project root folder | ||
|
||
4.) Install modules using ```npm install``` | ||
|
||
## Usage | ||
|
||
Currently, the Gruntfile has two options: | ||
|
||
* default, run: ```grunt``` | ||
* dev, run: ```grunt dev``` | ||
|
||
The **default** Grunt task will check your theme folder (check Gruntfile.js for the location) and will: | ||
* copy changed .css files to your deployment folder | ||
* when there are changes detected in any ```.scss``` file, run sass and place them in the source folder (on which these files will be copied to deployment as well) | ||
|
||
The **dev** Grunt task will do the same as default, but it will start your browser through a [Browsersync](http://www.browsersync.io/docs/grunt/) proxy. Any changes that you make in the css files will be automatically injected in your browser. You do not have to manually refresh your browser. | ||
|
||
## Done theming? | ||
|
||
Clean your project folder: Delete ```package.json```, ```Gruntfile.js``` and the ```node_modules``` folder | ||
|
||
## License | ||
|
||
Apache License, Version 2.0, January 2004 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "ux-grunt-theming", | ||
"private": true, | ||
"version": "1.0.0", | ||
"description": "Gruntfile for UX to make theming a lot easier", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [ | ||
"grunt", | ||
"mendix", | ||
"theming", | ||
"sass" | ||
], | ||
"author": "J.W. Lagendijk <jelte.lagendijk@mendix.com>", | ||
"license": "MIT", | ||
"dependencies": { | ||
"grunt": "^0.4.5", | ||
"grunt-browser-sync": "^2.2.0", | ||
"grunt-contrib-clean": "^0.7.0", | ||
"grunt-contrib-copy": "^0.8.2", | ||
"grunt-contrib-sass": "^0.9.2", | ||
"grunt-contrib-watch": "^0.6.1", | ||
"grunt-newer": "^1.1.1", | ||
"shelljs": "^0.5.3" | ||
} | ||
} |