Skip to content

Commit bdda3f0

Browse files
author
JelteMX
committed
Update Gulp
1 parent c0415a8 commit bdda3f0

File tree

6 files changed

+350
-32
lines changed

6 files changed

+350
-32
lines changed

Grunt/_package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "ux-grunt-theming",
33
"private": true,
44
"version": "{{{ version }}}",
5-
"description": "Gruntfile for UX to make theming a lot easier",
5+
"description": "Gruntfile for UX to make theming a lot easier (deprecated)",
66
"scripts": {
77
"test": "echo \"Error: no test specified\" && exit 1"
88
},

Gulp/_Gulpfile.js

Lines changed: 25 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,54 +19,54 @@ var proxyAddress = '{{{ localAddress }}}';
1919
* Don't try to edit below this line, unless you know what you are doing *
2020
*************************************************************************/
2121
var gulp = require('gulp'),
22-
sass = require('gulp-sass'),
23-
browserSync = require('browser-sync').create(),
24-
path = require('path'),
25-
sourcemaps = require('gulp-sourcemaps');
22+
sass = require('gulp-sass'),
23+
browserSync = require('browser-sync').create(),
24+
path = require('path'),
25+
sourcemaps = require('gulp-sourcemaps');
2626

2727
var sourceFolder = './' + sourceStyleFolder + '/',
28-
sourceSassFolder = sourceFolder + 'sass/',
29-
sourceCssFolder = sourceFolder + 'css/';
28+
sourceSassFolder = sourceFolder + 'sass/',
29+
sourceCssFolder = sourceFolder + 'css/';
3030

3131
var deploymentFolder = './deployment/web/' + deploymentStyleFolder,
32-
deploymentCssFolder = deploymentFolder + '/css/';
32+
deploymentCssFolder = deploymentFolder + '/css/';
3333

34-
gulp.task('build-sass', gulp.series(function () {
34+
gulp.task('build-sass', function () {
3535
return gulp.src(sourceSassFolder + '**/*.scss')
3636
.pipe(sass({
3737
outputStyle: 'expanded'
3838
}).on('error', sass.logError))
3939
.pipe(gulp.dest(sourceCssFolder))
4040
.pipe(gulp.dest(deploymentCssFolder));
41-
}));
41+
});
4242

43-
gulp.task('build', gulp.series(function () {
43+
gulp.task('build', function () {
4444
return gulp.src(sourceSassFolder + '**/*.scss')
4545
.pipe(sass({
4646
outputStyle: 'compressed'
4747
}).on('error', sass.logError))
4848
.pipe(gulp.dest(sourceCssFolder))
4949
.pipe(gulp.dest(deploymentCssFolder));
50-
}));
50+
});
5151

52-
gulp.task('copy-css', gulp.series(function () {
52+
gulp.task('copy-css', function () {
5353
return gulp.src(sourceCssFolder + '**/*.css')
5454
.pipe(gulp.dest(deploymentCssFolder));
55-
}));
55+
});
5656

57-
gulp.task('watch:sass', gulp.series(function () {
57+
gulp.task('watch:sass', function () {
5858
gulp.watch('**/*.scss', { cwd: sourceSassFolder }, gulp.series('build-sass'));
59-
}));
59+
});
6060

61-
gulp.task('watch:css', gulp.series(function () {
61+
gulp.task('watch:css', function () {
6262
gulp.watch('**/*.css', { cwd: sourceCssFolder }, gulp.series('copy-css'));
63-
}));
63+
});
6464

6565
gulp.task('default', gulp.series(['watch:sass']));
6666
gulp.task('css', gulp.series(['watch:css']));
6767

6868
// Browsersync
69-
gulp.task('browsersync-sass', gulp.series(function () {
69+
gulp.task('browsersync-sass', function () {
7070
return gulp.src(sourceSassFolder + '**/*.scss')
7171
.pipe(sourcemaps.init())
7272
.pipe(sass({
@@ -76,13 +76,13 @@ gulp.task('browsersync-sass', gulp.series(function () {
7676
.pipe(gulp.dest(sourceCssFolder))
7777
.pipe(gulp.dest(deploymentCssFolder))
7878
.pipe(browserSync.stream());
79-
}));
79+
});
8080

81-
gulp.task('watch:browsersync-sass', gulp.series(function () {
81+
gulp.task('watch:browsersync-sass', function () {
8282
gulp.watch('**/*.scss', { cwd: sourceSassFolder }, gulp.series('browsersync-sass'));
83-
}));
83+
});
8484

85-
gulp.task('dev', gulp.series(['browsersync-sass', 'watch:browsersync-sass'], function () {
85+
gulp.task('browsersync', function () {
8686
browserSync.init({
8787
proxy: {
8888
target: proxyAddress,
@@ -94,4 +94,6 @@ gulp.task('dev', gulp.series(['browsersync-sass', 'watch:browsersync-sass'], fun
9494
notify: true,
9595
ghostMode: false
9696
});
97-
}));
97+
});
98+
99+
gulp.task('dev', gulp.parallel(['browsersync-sass', 'watch:browsersync-sass', 'browsersync']));

Gulp/_package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"version": "{{{ version }}}",
55
"description": "Gulpfile for UX to make theming a lot easier",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"start": "./node_modules/.bin/gulp",
8+
"dev": "./node_modules/.bin/gulp dev"
89
},
910
"keywords": [
1011
"gulp",

README.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Grunt/Gulp for Mendix theming
1+
# Gulp for Mendix theming
22

33
Make it easier to develop Mendix themes, without the use of [Scout](https://docs.mendix.com/howto/ux/create-a-custom-theme-with-the-mendix-ui-framework) or [Koala](https://docs.mendix.com/howto/ux/setup-mendix-ui-framework-with-koala)
44

@@ -8,7 +8,7 @@ The following things need to be installed:
88
* [Node.js](https://nodejs.org/en/) **Please ensure you install the LTS version, 8.x.x. This is important!! It will fail on older versions like Node 6.x.x**
99

1010
If you want to use Gulp (**recommended**):
11-
* [Gulp client](https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md) (you can install this after installing Node using ```npm install gulp-cli -g```)
11+
* [Gulp client](https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md) (you can install this after installing Node using ```npm install gulp-cli -g```). **Note: Per version 1.6.0 this is unnecessary, because you can run it using npm**
1212

1313
If you want to use Grunt:
1414
* [Grunt client](http://gruntjs.com/getting-started) (you can install this after installing Node using ```npm install grunt-cli -g```)
@@ -18,7 +18,7 @@ Note:
1818
1919
## Installation
2020

21-
1.) Download the latest release (ZIP-file) [here](https://github.com/JelteMX/ux-grunt-theming/releases). **Do NOT download the source files, but choose Gulp.zip or Grunt.zip**
21+
1.) Download the latest release (ZIP-file) [here](https://github.com/JelteMX/ux-grunt-theming/releases). **Do NOT download the source files, but choose Gulp.zip**
2222

2323
2.) Unzip in your project root folder
2424

@@ -32,6 +32,23 @@ _If you do this on Windows and you encounter errors with installing the dependen
3232

3333
## Usage
3434

35+
### 1.6.0 and newer
36+
Per version 1.6.0 you can use the following tass using **npm** instead of **gulp**:
37+
38+
* **default**
39+
40+
```bash
41+
npm run start
42+
```
43+
44+
* **dev**
45+
46+
```bash
47+
npm run dev
48+
```
49+
50+
### 1.5.1 and older
51+
3552
Based on your choice between Gulp or Grunt, you have the following options:
3653

3754
* **default**, run from commandline:
@@ -58,6 +75,8 @@ or
5875
grunt dev
5976
```
6077

78+
### Tasks:
79+
6180
The **default** task will check your theme folder (check Gruntfile.js/Gulpfile.js for the location) and will:
6281
* copy changed .css files to your deployment folder
6382
* 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)
@@ -109,6 +128,12 @@ This is a common problem when you are using this in new Mendix Projects where it
109128

110129
This should fix your problem with missing stylesheets after a reload
111130

131+
#### **"I get the following error:"**
132+
133+
> ``gulpInst.start.apply(gulpInst, toRun); TypeError: Cannot read property 'apply' of undefined``
134+
135+
Your Gulp is outdated. Please run ``npm install gulp-cli -g`` again. Or use **npm**, see usage for 1.6.0 and newer.
136+
112137
## Done theming?
113138

114139
If you do not want the theming files to be part of the project (you can safely commit them, as long as you will add ``node_modules`` to **SVN Ignore**), you can clean your project folder by deleting:

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ux-theming",
3-
"version": "1.5.0",
3+
"version": "1.6.0",
44
"description": "Make theming easier, using Grunt or Gulp",
55
"scripts": {
66
"build": "node make",
@@ -16,8 +16,8 @@
1616
},
1717
"homepage": "https://github.com/mendix/ux-theming#readme",
1818
"devDependencies": {
19-
"archiver": "^1.1.0",
20-
"mustache": "^2.2.1",
21-
"shelljs": "^0.7.4"
19+
"archiver": "^2.1.1",
20+
"mustache": "^2.3.0",
21+
"shelljs": "^0.8.2"
2222
}
2323
}

0 commit comments

Comments
 (0)