Skip to content

Commit d041c71

Browse files
authored
Merge pull request #25 from CKGrafico/node-ts-dev
Fix some issues
2 parents cb863d6 + c08d64e commit d041c71

File tree

2 files changed

+126
-90
lines changed

2 files changed

+126
-90
lines changed

README.md

Lines changed: 120 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,47 @@
1-
# Gulp-Boilerplates
2-
<p align="center">
3-
<a href="https://raw.githubusercontent.com/CKGrafico/Gulp-Boilerplates/master/LICENSE">
4-
<img src="https://img.shields.io/badge/license-MIT-blue.svg"
5-
alt="license">
6-
</a>
7-
8-
<a href="https://codeclimate.com/github/CKGrafico/Gulp-Boilerplates">
9-
<img src="https://codeclimate.com/github/CKGrafico/Gulp-Boilerplates/badges/gpa.svg"
10-
alt="codeclimate"/>
11-
</a>
12-
</p>
1+
# Frontend Boilerplates
2+
Some examples of **good practises**, **tips**, and **boilerplates** that I like to follow. You will find the different technologies on the branches and we will add more examples in the future.
3+
4+
Feel free to give feedback and improvements to the repo.
5+
6+
[<img src="https://raw.githubusercontent.com/CKGrafico/Frontend-Boilerplates/gh-pages/resources/techs/spa.png" width="150" title="SPA">](https://github.com/CKGrafico/Frontend-Boilerplates/tree/master)
7+
[<img src="https://raw.githubusercontent.com/CKGrafico/Frontend-Boilerplates/gh-pages/resources/techs/ts.png" width="150" title="TypeScript">](https://github.com/CKGrafico/Frontend-Boilerplates/tree/ts-master)
8+
[<img src="https://raw.githubusercontent.com/CKGrafico/Frontend-Boilerplates/gh-pages/resources/techs/vue.png" width="150" title="Vuejs">](https://github.com/CKGrafico/Frontend-Boilerplates/tree/vue-master)
9+
[<img src="https://raw.githubusercontent.com/CKGrafico/Frontend-Boilerplates/gh-pages/resources/techs/nodets.png" width="150" title="Nodejs with TypeScript">](https://github.com/CKGrafico/Frontend-Boilerplates/tree/node-ts-master)
1310

1411
## Quickstart
15-
On this repo you can find some boilerplates based on Gulp, each branch has a different example.
16-
We try not only to use Gulp, also to use best practises and real examples that we can use on real projects.
17-
- **[master](https://github.com/CKGrafico/Gulp-Boilerplates/tree/master):** Stable version of a basic and generic example.
18-
- **[dev](https://github.com/CKGrafico/Gulp-Boilerplates/tree/dev):** Dev version of a TypeScript example.
19-
- **[ts-master](https://github.com/CKGrafico/Gulp-Boilerplates/tree/ts-master):** Stable version of a TypeScript example.
20-
- **[ts-dev](https://github.com/CKGrafico/Gulp-Boilerplates/tree/ts-dev):** Dev version of a basic and generic example.
21-
- **[node-ts-master](https://github.com/CKGrafico/Gulp-Boilerplates/tree/node-ts-master):** Stable version of node-based with TypeScript example.
22-
- **[node-ts-dev](https://github.com/CKGrafico/Gulp-Boilerplates/tree/node-ts-dev):** Dev version of node-based with TypeScript example.
23-
- **[vue-master](https://github.com/CKGrafico/Gulp-Boilerplates/tree/vue-master):** Stable version of vue-based example.
24-
- **[vue-dev](https://github.com/CKGrafico/Gulp-Boilerplates/tree/vue-dev):** Dev version of vue-based example.
25-
- **ng2-master:** Stable version of angular2-based example. [To do]
26-
- **ng2-dev:** Dev version of angular2-based example.
27-
28-
## Table of Contents
29-
1. [App Technologies](#app-technologies)
30-
1. [Tasks Technologies](#task-technologies)
31-
1. [Running tasks](#running-tasks)
32-
1. [Environments](#environments)
33-
1. [Project structure](#project-structure)
34-
1. [Gulpfile](#gulpfile)
35-
1. [Gulpfile Helpers](#gulpfile-helpers)
36-
1. [Gulpfile Paths](#gulpfile-paths)
37-
1. [Contributors](#contributors)
38-
1. [License](#license)
39-
40-
## App Technologies
12+
<img src="https://raw.githubusercontent.com/CKGrafico/Frontend-Boilerplates/gh-pages/resources/techs/spa.png" align="left" width="50" title="SPA">
13+
14+
**[master:](https://github.com/CKGrafico/Frontend-Boilerplates/tree/master)** Stable version of a **basic SPA** example with SCSS and ES6.
15+
<br>**[dev:](https://github.com/CKGrafico/Frontend-Boilerplates/tree/dev)** Dev version of a **basic SPA** example with SCSS and ES6.
16+
17+
<img src="https://raw.githubusercontent.com/CKGrafico/Frontend-Boilerplates/gh-pages/resources/techs/ts.png" align="left" width="50" title="TypeScript">
18+
19+
**[ts-master:](https://github.com/CKGrafico/Frontend-Boilerplates/tree/ts-master)** Stable version of a **TypeScript** example with SCSS.
20+
<br>**[ts-dev:](https://github.com/CKGrafico/Frontend-Boilerplates/tree/ts-dev)** Dev version of a **TypeScript** example with SCSS.
21+
22+
<img src="https://raw.githubusercontent.com/CKGrafico/Frontend-Boilerplates/gh-pages/resources/techs/vue.png" align="left" width="50" title="TypeScript">
23+
24+
**[vue-master:](https://github.com/CKGrafico/Frontend-Boilerplates/tree/vue-master)** Stable version of a **Vuejs** example with SCSS and TypeScript.
25+
<br>**[vue-dev:](https://github.com/CKGrafico/Frontend-Boilerplates/tree/vue-dev)** Dev version of a **Vuejs** example with SCSS and TypeScript.
26+
27+
<img src="https://raw.githubusercontent.com/CKGrafico/Frontend-Boilerplates/gh-pages/resources/techs/nodets.png" align="left" width="50" title="Node with TypeScript">
28+
29+
**[node-ts-master:](https://github.com/CKGrafico/Frontend-Boilerplates/tree/node-ts-master)** Stable version of a **Nodejs with TypeScript** example with SCSS and Nodejs.
30+
<br>**[node-ts-dev:](https://github.com/CKGrafico/Frontend-Boilerplates/tree/node-ts-dev)** Dev version of a **Nodejs with TypeScript** example with SCSS and Nodejs.
31+
32+
## 🍩 App Features
4133
On this branch _(Basic)_ we use:
4234
- **BEM + BEMIT + etc:** A mix of BEM and related-BEM technologies to create conventions for CSS classes.
4335
- **TypeScript:** This project uses TypeScript instead of JavaScript.
4436
- **Linting:** Linting for JavaScript and SASS.
4537
- **Normalize:** Normalize our css, you can extend it easily.
4638
- **SASS:** Scss structure with good practises.
4739

48-
**[ back to top](#table-of-contents)**
40+
**[⬆️ back to top](#quickstart)**
4941

50-
## Tasks Technologies
42+
## ⚙️ Automated Tasks
5143
On this branch _(Basic)_ we use:
44+
- **Concurrently:** Execute two tasks in parallel.
5245
- **Gulp Autoprefixer:** Add browser prefixes for last two versions of the browsers.
5346
- **Gulp Clean CSS:** To minify CSS.
5447
- **Gulp Environment:** Call to different tasks depending of the environment.
@@ -58,7 +51,6 @@ On this branch _(Basic)_ we use:
5851
- **Gulp Newer:** On some tasks we want to do something only with the newer files.
5952
- **Gulp Nodemon:** To launch the NodeJS application.
6053
- **Gulp Noop:** Basic Noop but on stream.
61-
- **Gulp Rollup:** To transpile out code.
6254
- **Gulp Sass:** Compile Scss to CSS.
6355
- **Gulp Sasslint:** Linting for SASS.
6456
- **Gulp Sourcemaps:** Generate Sourcemaps when is necessary.
@@ -68,30 +60,34 @@ On this branch _(Basic)_ we use:
6860
- **Require all:** Load all gulp tasks once.
6961
- **Yarn:** Instead of NPM.
7062

71-
**[ back to top](#table-of-contents)**
63+
**[⬆️ back to top](#quickstart)**
7264

73-
## Running tasks
65+
## Running tasks
7466
To run the tasks we have these three commands:
7567
- Install dependencies:
76-
> yarn install
68+
> npm install
69+
70+
- Running tasks on production mode:
71+
> npm run prod
7772
7873
- Running tasks on development mode:
79-
> yarn run dev
74+
> npm run dev
8075
81-
- Running tasks on production mode:
82-
> yarn run prod
76+
- Running tasks on local mode:
77+
> npm run local
8378
84-
- Running tasks on watch mode:
85-
> yarn run watch
79+
- Running tasks on watch mode and serve the app:
80+
> npm start
8681
87-
**[ back to top](#table-of-contents)**
82+
**[⬆️ back to top](#quickstart)**
8883

89-
## Environments
84+
## 🔮 Environments
9085
On this project we have two environments:
91-
- **Development:** To use with dev and watch tasks
92-
- **Production:** To minify the code and use on production
86+
- **Local:** Use this on your computer
87+
- **Development:** Use this on your dev server
88+
- **Production:** Use this on your production server
9389

94-
## Project structure
90+
## ⛩️ Project structure
9591
On this branch _(Basic)_ the structure is:`
9692
```
9793
./
@@ -138,6 +134,12 @@ On this branch _(Basic)_ the structure is:`
138134
├── dist/ # Distribution folder
139135
140136
├── tasks/ # Gulp tasks
137+
│ ├── config/
138+
│ │ ├── helpers.js # Helpers that useful for tasks
139+
│ │ └── options.js # Internal operation to use with tasks
140+
│ ├── rules/
141+
│ │ ├── scripts.js # Create a bundle for JavaScript files
142+
│ │ └── scripts-lint.js # Check linting of JavaScript files
141143
│ ├── assets.js # Minify images and generate fonts
142144
│ ├── clean.js # Clean distribution folder
143145
│ ├── copy.js # Copy index.html to dist
@@ -149,18 +151,20 @@ On this branch _(Basic)_ the structure is:`
149151
│ ├── ts-lint.js # Linting for TypeScript
150152
│ └── watch.js # Watcher for files
151153
154+
├── .gulpenvrc.yml # Environments configuration
152155
├── .sass-lint.yml # SASS linting configuration
153156
├── .scripts-lint.yml # JavaScript linting configuration
154-
├── gulpfile.helpers.js # Some methods to use on gulp tasks
155157
├── gulpfile.js # Main gulp file
156-
├── gulpfile.paths.js # Where you can configure the paths to use with tasks
157158
├── package.json # Configure npm tasks and dependencies
158-
└── yarn-lock # Yarn file with the specific version to download of each dependency
159+
├── tasks.config.json # Configure paths and options for tasks
160+
└── webpack.config.js # The Webpack configuration for scripts
159161
```
160162

161-
**[ back to top](#table-of-contents)**
163+
**[⬆️ back to top](#quickstart)**
164+
165+
## ⚡ Gulp and Webpack
162166

163-
## Gulpfile
167+
### Gulpfile
164168
This is how we configured the main file:
165169
```
166170
// We load all the tasks and pass some parameters
@@ -173,13 +177,11 @@ tasks((name, task) => { func = () => task(gulp, paths, $, _, tasks); func.displa
173177

174178
And these are the only two tasks:
175179
```
176-
gulp.task('default', gulp.series(tasks.clean, tasks.scssLint, tasks.scss, tasks.scriptsLint, tasks.scripts, tasks.copy, tasks.assets));
180+
gulp.task('default', gulp.series(tasks.clean, tasks.stylesLint, tasks.styles, tasks.copy, tasks.assets));
177181
gulp.task('watcher', gulp.parallel(tasks.serve, tasks.watch));
178182
```
179183

180-
**[ back to top](#table-of-contents)**
181-
182-
## Gulpfile Helpers
184+
### Gulpfile helpers
183185
In case that you want to modify some gulp tasks, this helpers can help you.
184186

185187
- Files and folders:
@@ -199,19 +201,20 @@ _.files(paths.app.scripts, _.NOT)
199201
```
200202
Exclude scripts, example: _'!./app/js/**/*.js'_
201203

202-
**[ back to top](#table-of-contents)**
203-
204-
## Gulpfile paths
205-
We tried to do it as easy as possible and this is the result.
206-
We have an object with our paths structure that can be generated automatically and can be extended.
204+
```
205+
_.abs(_.folder(paths.app.scripts), __dirname)
206+
```
207+
Change path to absolute path: _'C:/project/app/js'_
207208

208-
If you open gulpfile.paths and you write this:
209+
**[⬆️ back to top](#quickstart)**
209210

211+
### Tasks configuration
212+
You can configure different things related with the tasks.
210213
```
211-
let paths = {
212-
app: {
213-
assets: {
214-
images: {}
214+
{
215+
"app": {
216+
"assets": {
217+
"images": {}
215218
}
216219
}
217220
};
@@ -228,13 +231,13 @@ _.files(paths.assets.images)
228231
But you can extend this structure:
229232

230233
```
231-
let paths = {
232-
app: {
233-
assets: {
234-
images: {},
235-
fonts: {
236-
_files: '**/*.ttf',
237-
_folder: 'custom',
234+
{
235+
"app": {
236+
"assets": {
237+
"images": {},
238+
"fonts": {
239+
"files": "**/*.ttf",
240+
"folder": "custom"
238241
}
239242
}
240243
}
@@ -249,13 +252,45 @@ _.files(paths.assets.fonts)
249252
// ./app/assets/custom/**/*.ttf
250253
```
251254

252-
**[ back to top](#table-of-contents)**
255+
Also you can use the parent folder
256+
257+
```
258+
{
259+
"app": {
260+
"assets": {
261+
"images": {},
262+
"fonts": {
263+
"files": "**/*.ttf",
264+
"folder": "custom"
265+
"roboto": {
266+
"files": "Roboto.ttf",
267+
"folder": "..",
268+
}
269+
}
270+
}
271+
}
272+
};
273+
```
274+
And the result will look like that:
275+
```
276+
_.folder(paths.assets.fonts.roboto);
277+
// ./app/assets/fonts/
278+
279+
_.files(paths.assets.fonts.roboto)
280+
// ./app/assets/fonts/roboto.ttf
281+
```
282+
283+
**[⬆️ back to top](#quickstart)**
284+
285+
## 🎩 Contributors
286+
253287

254-
## Contributors
288+
| <img src="https://i.imgur.com/CcJ7vXL.jpg" width="150"><br>**Quique Fdez Guerra**<br>[👨‍💻](https://github.com/CKGrafico)[🌍](http://ckgrafico.com)[🐦](https://twitter.com/CKGrafico) | <img src="https://i.imgur.com/W8Ks7Ss.jpg" width="150"><br>**Juan Carlos**<br>[👨‍💻](https://github.com/jcarloslr10)[🌍](http://plainconcepts.com)[🐦](https://twitter.com/jcarloslr10) | <img src="https://i.imgur.com/kLqGDso.jpg" width="150"><br>**Alex Kryzhanovskyy**<br>[👨‍💻](https://github.com/AlexKryzh)[🌍](http://kryzh.com)[🐦](https://twitter.com/AlexKryzh) |
289+
| :---: | :---: | :---: |
255290

256-
[View Contributors](https://github.com/CKGrafico/Gulp-Boilerplates/graphs/contributors)
291+
[View Contributors](https://github.com/CKGrafico/Frontend-Boilerplates/graphs/contributors)
257292

258-
## License
293+
## 📜 License
259294

260295
(The MIT License)
261296

@@ -280,4 +315,4 @@ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
280315
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
281316
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
282317

283-
**[ back to top](#table-of-contents)**
318+
**[⬆️ back to top](#quickstart)**

package.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
2-
"name": "myapp",
3-
"version": "1.1.0",
2+
"name": "app-nodejs",
3+
"description": "Stable version of a basic SPA example with SCSS and Nodejs.",
4+
"license": "MIT",
5+
"version": "2.1.2",
46
"dependencies": {
57
"express": "^4.15.2",
68
"normalize-scss": "^6.0.0",
@@ -35,7 +37,6 @@
3537
"prewatch": "npm run dev",
3638
"watch": "gulp --env=development watcher"
3739
},
38-
"description": "Boilerplate with Gulp + SASS and TypeScript with NodeJS",
39-
"repository": "https://github.com/CKGrafico/Gulp-Boilerplates",
40-
"author": "Quique Fdez Guerra @CKGrafico"
40+
"repository": "https://github.com/CKGrafico/Frontend-Boilerplates#frontend-boilerplates",
41+
"author": "https://github.com/CKGrafico/Frontend-Boilerplates#-contributors"
4142
}

0 commit comments

Comments
 (0)