Skip to content
This repository was archived by the owner on Feb 21, 2025. It is now read-only.

Commit cf7d236

Browse files
committed
feat(docs): improve it
1 parent e1e1be3 commit cf7d236

File tree

7 files changed

+119
-87
lines changed

7 files changed

+119
-87
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,19 @@ This theme core is to be included in your main project and sets up many Gulp tas
1818

1919
All is easily configurable by changing values in your `gulpfile.yml` file in your project. These values are merged into the `gulpfile.default.yml` file - look there for the available options and defaults.
2020

21+
22+
## Documentation
23+
24+
Full documentation is available [here](https://drucker.readthedocs.io/en/latest).
25+
26+
2127
### TODO
2228

2329
- BrowserSync live reload and style injection (should be OK, not tested)
2430
- Images => Images optimization (to validate)
2531
- JS specs => JS tests using Karma
2632

2733

28-
## Documentation
29-
30-
Full documentation is available [here](https://drucker.readthedocs.io/en/latest).
31-
32-
3334
## Contributing
3435

3536
Have a look at the [Contributing section](.github/CONTRIBUTING.md). If you have any question feel free to discuss about it on our [Gitter](https://gitter.im/ovh/ux).

docs/features/drupal-drush.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@ Launch a Drupal command.
1212

1313
## Notes
1414

15-
- If you want to use it with [Drucker](https://github.com/ovh-ux/drucker), you need to:
15+
If you want to use it with [Drucker](https://github.com/ovh-ux/drucker), you need to:
1616
- set the `config.drupal.dir` to `./path/to/drucker`
1717
- set the `config.drupal.command` to `. load-env && drush cc all`

docs/features/js.md

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,12 @@
11
Compiles JS files using Babel. You can optionaly concat, uglify, and add sourcemaps.
22

3+
!!! note ""
4+
It's recommanded to use [Webpack](features/webpack.md) instead.
5+
36
## Commands
47

58
- `gulp js` - Compile all JS files using Babel
69
- `gulp watch:js` - Watch and compile
710
- `gulp validate:js` - Test JS with ESLINT
811
- `gulp js:bundleBower` - (optional) compile, uglify, concat bower dependencies (result files will be `bower--*deps*.js`)
912
- `gulp watch:bower` - (optional) Watch and compile bower deps
10-
11-
12-
# Webpack
13-
14-
Manager your JS files using Webpack.
15-
16-
## Usage
17-
18-
Copy the `webpack.config.js` example file in your project.
19-
You can then configure the JS bundles that you want:
20-
```js
21-
entry: {
22-
main: path.resolve(__dirname, './js/main.js')
23-
[...]
24-
},
25-
```
26-
27-
## Commands
28-
29-
- `gulp webpack` - Launch Webpack compilation
30-
- `gulp watch:webpack` - Watch and compile

docs/features/webpack.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Manage your JS files using Webpack.
2+
3+
## Usage
4+
5+
Copy the `webpack.config.js` example file in your project.
6+
You can then configure the JS bundles that you want:
7+
```js
8+
entry: {
9+
main: path.resolve(__dirname, './js/main.js')
10+
[...]
11+
},
12+
```
13+
14+
## Commands
15+
16+
- `gulp webpack` - Launch Webpack compilation
17+
- `gulp watch:webpack` - Watch and compile

docs/index.md

Lines changed: 14 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ This theme core is to be included in your main project and sets up many Gulp tas
1616

1717
All is easily configurable by changing values in your `gulpfile.yml` file in your project. These values are merged into the `gulpfile.default.yml` file - look there for the available options and defaults.
1818

19-
### TODO
20-
21-
- BrowserSync live reload and style injection (should be OK, not tested)
22-
- Images => Images optimization (to validate)
23-
- JS specs => JS tests using Karma
24-
2519

2620
## Prerequisites
2721

@@ -31,66 +25,26 @@ All is easily configurable by changing values in your `gulpfile.yml` file in you
3125

3226
## Installation
3327

34-
- `npm install gulp-drupal-theme-core --save-dev`
35-
- Create a `gulpfile.yml` in your theme, and overrides options from the `gulpfile.default.yml`
36-
- Make a `gulpfile.js` in your project, with:
37-
```js
38-
"use strict";
39-
40-
const gulp = require("gulp");
41-
const yaml = require("js-yaml");
42-
const fs = require("fs");
43-
44-
// `rc` allows all config options to be overridden with CLI flags like `--js.enabled="` or in `~/.p2-theme-corerc` files, among many others: https://www.npmjs.com/package/rc
45-
const config = require("rc")("gulp-drupal-theme-core", yaml.safeLoad(fs.readFileSync(`${__dirname}/gulpfile.yml`, "utf8"), { json: true }));
46-
const themeCore = require("gulp-drupal-theme-core");
47-
48-
const tasks = {
49-
compile: [],
50-
watch: [],
51-
validate: [],
52-
clean: [],
53-
"default": []
54-
};
55-
56-
themeCore(gulp, config, tasks);
57-
58-
gulp.task("clean", gulp.parallel(tasks.clean));
59-
gulp.task("compile", gulp.series(
60-
"clean",
61-
gulp.series(tasks.compile)
62-
));
63-
gulp.task("validate", gulp.parallel(tasks.validate));
64-
gulp.task("watch", gulp.parallel(tasks.watch));
65-
tasks.default.push("watch");
66-
gulp.task("default", gulp.series(
67-
"compile",
68-
gulp.parallel(tasks.default)
69-
));
28+
Follow theses steps:
29+
30+
```bash
31+
$ cd <your-theme>
32+
# Install it
33+
$ npm install gulp-drupal-theme-core --save-dev
34+
# Create a gulpfile.js
35+
$ cp node_modules/gulp-drupal-theme-core/templates/gulpfile.js ./
36+
# Create a gulpfile.yml (config file)
37+
$ vi gulpfile.yml
38+
# <set the config that you want, and save it>
7039
```
7140

72-
### Babel
73-
In order to use Babel, you need to create a `.babelrc` into your project, with the presets that you want installed.
74-
75-
### ESLINT
76-
You need to create a `.eslintrc.js` file, and specify whitch rules that you want (`eslint-config-ovh` is recommanded).
41+
!!! note ""
42+
See the [Config](config.yml) section for the documentation about the configuration file.
7743

7844

7945
## Usage
8046

81-
### Global Commands
82-
83-
- `gulp` - Run all compile tasks, and watch for changes
84-
- `gulp compile` - Run all compile tasks
85-
- `gulp validate` - Run all validate tasks (eslint, ...)
86-
- `gulp watch` - Watch for changes
87-
- `gulp clean` - Run all clean tasks
88-
89-
### Specifics Commands
90-
91-
You can launch specifics tasks, for example "lint CSS files". In this example, you can use `gulp validate:css`.
92-
93-
All the documentation can be found inside the [Features](features) section.
47+
See [Usage](usage.md) section.
9448

9549

9650
## Credits

docs/usage.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
## Commands
2+
3+
- `gulp` - Run all compile tasks, and watch for changes
4+
- `gulp compile` - Run all compile tasks
5+
- `gulp validate` - Run all validate tasks (eslint, ...)
6+
- `gulp watch` - Watch for changes
7+
- `gulp clean` - Run all clean tasks
8+
9+
## Specifics Commands
10+
11+
You can launch specifics tasks, for example "lint CSS files". In this example, you can use `gulp validate:css`.
12+
13+
All the documentation can be found inside the [Features](features) section.
14+
15+
16+
### Babel
17+
18+
In order to use Babel, you need to create a `.babelrc` into your project, with the presets that you want installed.
19+
20+
**Example:**
21+
Run:
22+
```bash
23+
$ npm install --save-dev babel-preset-es2015
24+
```
25+
And create a `.babelrc` file:
26+
```json
27+
{
28+
"presets": ["es2015"]
29+
}
30+
```
31+
32+
### ESLINT
33+
34+
You need to create a `.eslintrc.js` file, and specify whitch rules that you want (`eslint-config-ovh` is recommanded).
35+
36+
**Example:**
37+
Run:
38+
```bash
39+
$ npm install --save-dev babel-eslint
40+
$ npm install --save-dev eslint-config-ovh
41+
```
42+
And create a `.eslintrc.js` file:
43+
```javascript
44+
"use strict";
45+
// rule reference: http://eslint.org/docs/rules
46+
// individual rule reference: http://eslint.org/docs/rules/NAME-OF-RULE
47+
48+
module.exports = {
49+
extends: "ovh/configs/es6-browser",
50+
globals: {
51+
Drupal: true,
52+
jQuery: true,
53+
_: true,
54+
domready: true
55+
}
56+
};
57+
```
58+
59+
### STYLELINT
60+
61+
You need to create a `.stylelintrc.js` file, and specify whitch rules that you want (`stylelint-config-ovh` is recommanded).
62+
63+
**Example:**
64+
Run:
65+
```bash
66+
$ npm install --save-dev stylelint-scss
67+
$ npm install --save-dev stylelint-config-ovh
68+
```
69+
And create a `.stylelintrc.js` file:
70+
```javascript
71+
"use strict";
72+
73+
module.exports = {
74+
"extends": "stylelint-config-ovh/configs/scss"
75+
};
76+
```

mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ docs_dir: docs
33

44
pages:
55
- Home: index.md
6+
- Usage: usage.md
67
- Features:
78
- CSS: features/css.md
89
- JS: features/js.md
10+
- Webpack: features/webpack.md
911
- Icons: features/icons.md
1012
- Drupal-Drush: features/drupal-drush.md
1113
- BrowserSync: features/browser-sync.md

0 commit comments

Comments
 (0)