Skip to content

Commit 22f910c

Browse files
author
JelteMX
committed
Updating Gulp to the latest standard, fixing Browsersync issues, adding more Troubleshooting tips
1 parent d51bdc0 commit 22f910c

File tree

5 files changed

+60
-19
lines changed

5 files changed

+60
-19
lines changed

Gulp/_Gulpfile.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,15 @@ gulp.task('build-sass', function () {
4040
.pipe(gulp.dest(deploymentCssFolder));
4141
});
4242

43+
gulp.task('build', function () {
44+
return gulp.src(sourceSassFolder + '**/*.scss')
45+
.pipe(sass({
46+
outputStyle: 'compressed'
47+
}).on('error', sass.logError))
48+
.pipe(gulp.dest(sourceCssFolder))
49+
.pipe(gulp.dest(deploymentCssFolder));
50+
});
51+
4352
gulp.task('copy-css', function () {
4453
return gulp.src(sourceCssFolder + '**/*.css')
4554
.pipe(gulp.dest(deploymentCssFolder));
@@ -55,7 +64,6 @@ gulp.task('watch:css', function () {
5564

5665
gulp.task('default', ['watch:sass']);
5766
gulp.task('css', ['watch:css']);
58-
gulp.task('build', ['build-sass']);
5967

6068
// Browsersync
6169
gulp.task('browsersync-sass', function () {
@@ -76,8 +84,14 @@ gulp.task('watch:browsersync-sass', function () {
7684

7785
gulp.task('dev', ['browsersync-sass', 'watch:browsersync-sass'], function () {
7886
browserSync.init({
79-
proxy: proxyAddress,
80-
online: false,
81-
ws: true
87+
proxy: {
88+
target: proxyAddress,
89+
ws: true
90+
},
91+
online: true,
92+
open: true,
93+
reloadOnRestart: true,
94+
notify: true,
95+
ghostMode: false
8296
});
8397
});

Gulp/_package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
"repository": "{{{ repository }}}",
1717
"license": "MIT",
1818
"dependencies": {
19-
"browser-sync": "*",
20-
"gulp": "*",
21-
"gulp-sass": "*",
22-
"gulp-sourcemaps": "*"
19+
"browser-sync": "^2.23.6",
20+
"gulp": "^3.9.1",
21+
"gulp-sass": "^3.1.0",
22+
"gulp-sourcemaps": "^2.6.4"
2323
}
2424
}

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
The MIT License (MIT)
2-
Copyright (c) 2016 Mendix
2+
Copyright (c) 2018 Mendix
33

44
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
55

README.md

Lines changed: 36 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ Make it easier to develop Mendix themes, without the use of [Scout](https://docs
55
## Prerequisites (only need to do this once)
66

77
The following things need to be installed:
8-
* [Node.js](https://nodejs.org/en/) **Please ensure you install the LTS version, 8.x.x**
8+
* [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

10-
If you want to use Gulp (recommended):
10+
If you want to use Gulp (**recommended**):
1111
* [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```)
1212

1313
If you want to use Grunt:
@@ -76,27 +76,54 @@ Make sure ``proxyAddress`` is pointed to your local deployment.
7676

7777
## Troubleshooting
7878

79-
* **``npm install`` fails**<br /><br />
80-
Make sure you have the package.json and Gruntfile.js/Gulpfile.js in your root folder. Also, if there are errors installing (this can happen when you install the Gulp version), make sure you have administrator rights. See point 3 at Installation.
79+
#### **``npm install`` fails**<br /><br />
8180

82-
* **"I started the dev task, but my ``localhost:3000`` keeps loading"**<br /><br />
83-
Have you pointed to the right local deployment address? Check the proxyAddress in your Gulp-/Gruntfile.js. This should correspond to the address of your local deployment.
81+
Make sure you have the package.json and Gruntfile.js/Gulpfile.js in your root folder. Also, if there are errors installing (this can happen when you install the Gulp version), make sure you have administrator rights. See point 3 at Installation.
82+
83+
#### **"I started the dev task, but my ``localhost:3000`` keeps loading"**<br /><br />
84+
85+
Have you pointed to the right local deployment address? Check the proxyAddress in your Gulp-/Gruntfile.js. This should correspond to the address of your local deployment.
86+
87+
#### **"I use the DEV task, but on reload it is missing styles"**<br /><br />
88+
89+
This is a common problem when you are using this in new Mendix Projects where it is using Deeplinks (e.g. http://localhost:3000/link/page). The reason for this is that the paths to the styles are relative in your HTML. Please check the following:
90+
91+
* Open the 'index.html' (or the one that is used, for example 'index2.html')
92+
* In the ``<head>`` section you will find the links to stylesheets:
93+
94+
```html
95+
<link rel="stylesheet" href="lib/bootstrap/css/bootstrap.min.css?{{cachebust}}">
96+
<link rel="stylesheet" href="mxclientsystem/mxui/ui/mxui.css?{{cachebust}}">
97+
<link rel="stylesheet" href="css/custom.css?{{cachebust}}">
98+
<link rel="stylesheet" href="css/custom/custom.css?{{cachebust}}">
99+
```
100+
101+
* Make sure that any of these links to the stylesheets are prefixed with a ``/``, so it will always refer to the root:
102+
103+
```html
104+
<link rel="stylesheet" href="/lib/bootstrap/css/bootstrap.min.css?{{cachebust}}">
105+
<link rel="stylesheet" href="/mxclientsystem/mxui/ui/mxui.css?{{cachebust}}">
106+
<link rel="stylesheet" href="/css/custom.css?{{cachebust}}">
107+
<link rel="stylesheet" href="/css/custom/custom.css?{{cachebust}}">
108+
```
109+
110+
This should fix your problem with missing stylesheets after a reload
84111

85112
## Done theming?
86113

87-
Clean your project folder by deleting:
114+
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:
88115
* ```package.json```
89116
* ```Gruntfile.js``` or ```Gulpfile.js```
90117
* ```node_modules``` folder
91118

92119
## TODO
93120

94-
* ~~Check if Sass & Compass are still necessary~~ The later versions of node-sass will download their own binary, so you don't need to install Sass yourself.
121+
None
95122

96123
## License
97124

98125
The MIT License (MIT)
99-
Copyright (c) 2017 Mendix
126+
Copyright (c) 2018 Mendix
100127

101128
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
102129

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ux-theming",
3-
"version": "1.3.3",
3+
"version": "1.4.0",
44
"description": "Make theming easier, using Grunt or Gulp",
55
"scripts": {
66
"build": "node make",

0 commit comments

Comments
 (0)