Skip to content

Commit 286c07b

Browse files
Merge pull request #2 from processing/master
update my fork to the original repo
2 parents b724740 + afebaca commit 286c07b

File tree

462 files changed

+32768
-283201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

462 files changed

+32768
-283201
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ node_modules
2424
.idea/
2525

2626
src/templates/pages/examples/*
27+
src/templates/pages/learn/index.hbs
28+
src/templates/pages/libraries/index.hbs
2729
src/offline-reference
2830
!src/templates/pages/examples/.gitkeep
2931
dist/*

.lintstagedrc.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module.exports = {
2+
'src/data/en.yml': () => ['grunt i18n --changed', 'git add i18n-tracking.yml']
3+
}

Gruntfile.js

Lines changed: 81 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,19 @@ module.exports = function(grunt) {
2323
dist: 'dist'
2424
},
2525
exec: {
26-
build_examples: 'node <%= config.src %>/data/examples/build_examples/build.js <%= config.src %>/templates/pages/examples/'
26+
build_examples: 'node <%= config.src %>/data/examples/build_examples/build.js <%= config.src %>/templates/pages/examples/',
27+
build_libraries: 'node <%= config.src %>/data/libraries/build.js <%= config.src %>/templates/pages/libraries/',
28+
build_learn: 'node <%= config.src %>/data/learn/build.js <%= config.src %>/templates/pages/learn/'
2729
},
2830
watch: {
2931
assemble: {
30-
files: '<%= config.src %>/{content,data,templates}/{,*/}*.{md,hbs,yml,json}',
32+
files: '<%= config.src %>/{content,data,templates}/**/*.{md,hbs,yml,json}',
3133
tasks: ['assemble']
3234
},
3335
css: {
3436
files: '<%= config.src %>/assets/css/*.css',
3537
tasks: [
3638
'concat:dist',
37-
// 'uncss',
3839
'postcss'
3940
]
4041
},
@@ -52,7 +53,8 @@ module.exports = function(grunt) {
5253
'<%= config.dist %>/assets/js/*.js',
5354
'<%= config.dist %>/assets/img/*.{png,jpg,jpeg,gif,webp,svg,ico}',
5455
'<%= config.dist %>/assets/p5_featured/{,*/}*.*',
55-
'<%= config.dist %>/assets/learn/{,*/}*.*'
56+
'<%= config.dist %>/assets/learn/{,*/}*.*',
57+
'<%= config.dist %>/assets/contributor-docs/*.*'
5658
]
5759
}
5860
},
@@ -81,10 +83,13 @@ module.exports = function(grunt) {
8183
options: {
8284
expand: true,
8385
flatten: true,
84-
helpers: ['<%= config.src %>/assets/js/translation.js'],
8586
assets: '<%= config.dist %>/assets',
87+
helpers: ['<%= config.src %>/assets/js/translation.js', '<%= config.src %>/assets/js/cache-busting.js'],
8688
layout: '<%= config.src %>/templates/layouts/default.hbs',
87-
data: ['<%= config.src %>/data/**/*.{json,yml}', '!<%= config.src %>/data/reference/*.json'],
89+
data: [
90+
'<%= config.src %>/data/**/*.{json,yml}',
91+
'!<%= config.src %>/data/reference/*.json'
92+
],
8893
partials: '<%= config.src %>/templates/partials/*.hbs',
8994
plugins: [
9095
'assemble-contrib-permalinks',
@@ -118,7 +123,7 @@ module.exports = function(grunt) {
118123
}
119124
},
120125
dest: '<%= config.dist %>',
121-
src: "!*.*"
126+
src: '!*.*'
122127
}
123128
},
124129

@@ -158,7 +163,7 @@ module.exports = function(grunt) {
158163
// CSS:
159164
concat: {
160165
options: {
161-
separator: ';',
166+
separator: ';'
162167
},
163168
dist: {
164169
src: [
@@ -171,21 +176,20 @@ module.exports = function(grunt) {
171176
},
172177
postcss: {
173178
options: {
174-
map: true,
175179
map: {
176180
inline: false,
177181
annotation: '<%= config.dist %>/assets/css/maps/'
178182
},
179183
processors: [
180184
require('autoprefixer')({browsers: [
181-
"Android 2.3",
182-
"Android >= 4",
183-
"Chrome >= 20",
184-
"Firefox >= 24",
185-
"Explorer >= 8",
186-
"iOS >= 6",
187-
"Opera >= 12",
188-
"Safari >= 6"
185+
'Android 2.3',
186+
'Android >= 4',
187+
'Chrome >= 20',
188+
'Firefox >= 24',
189+
'Explorer >= 8',
190+
'iOS >= 6',
191+
'Opera >= 12',
192+
'Safari >= 6'
189193
]}),
190194
require('cssnano')()
191195
]
@@ -224,32 +228,44 @@ module.exports = function(grunt) {
224228
examples: {
225229
expand: true,
226230
cwd: '<%= config.src %>/data/examples',
227-
src: ['**', '!build_examples/**' ],
231+
src: ['**', '!build_examples/**'],
228232
dest: '<%= config.dist %>/assets/examples'
229233
},
234+
contributor_docs: {
235+
expand: true,
236+
cwd: '<%= config.src %>/assets/contributor-docs',
237+
src: '**',
238+
dest: '<%= config.dist %>/contributor-docs'
239+
},
230240
reference: {
231241
expand: true,
232242
cwd: '<%= config.src %>/data/reference',
233243
src: ['**'],
234244
dest: '<%= config.dist %>/assets/reference'
235245
},
236246
reference_assets: {
237-
expand: true,
238-
cwd: '<%= config.src %>/templates/pages/reference/',
239-
src: ['**/!(*.hbs)'],
240-
dest: '<%= config.dist %>/reference/'
241-
},
242-
reference_es: {
243-
expand: true,
244-
cwd: '<%= config.dist %>/reference',
245-
src: ['**'],
246-
dest: '<%= config.dist %>/es/reference'
247-
},
248-
reference_zh_Hans: {
249-
expand: true,
250-
cwd: '<%= config.dist %>/reference',
251-
src: ['**'],
252-
dest: '<%= config.dist %>/zh-Hans/reference'
247+
files: (function() {
248+
const cp = [];
249+
pkg.languages.forEach(language => {
250+
if (language === 'en') {
251+
cp.push({
252+
expand: true,
253+
cwd: '<%= config.src %>/templates/pages/reference/',
254+
src: ['**/!(*.hbs)'],
255+
dest: '<%= config.dist %>/reference/'
256+
});
257+
} else {
258+
cp.push({
259+
expand: true,
260+
cwd: '<%= config.src %>/templates/pages/reference/',
261+
src: ['**/!(*.hbs)'],
262+
dest: `<%= config.dist %>/${language}/reference/`
263+
});
264+
}
265+
});
266+
267+
return cp;
268+
})()
253269
},
254270
offlineReference: {
255271
files: [
@@ -298,7 +314,7 @@ module.exports = function(grunt) {
298314
default_options: {
299315
files: [
300316
{
301-
prepend: "referenceData = ",
317+
prepend: 'referenceData = ',
302318
input: '<%= config.src %>/templates/pages/reference/data.json',
303319
output: '<%= config.src %>/offline-reference/js/data.js'
304320
}
@@ -309,17 +325,36 @@ module.exports = function(grunt) {
309325
compress: {
310326
main: {
311327
options: {
312-
archive: '<%= config.dist %>/offline-reference/p5-reference.zip',
328+
archive: '<%= config.dist %>/offline-reference/p5-reference.zip'
313329
},
314330
expand: true,
315331
cwd: '<%= config.src %>/offline-reference',
316332
src: ['**/*'],
317333
dest: 'p5-reference/'
318334
}
335+
},
336+
htmllint: {
337+
all: {
338+
src: [
339+
'<%= config.dist %>/**/*.html',
340+
'!<%= config.dist %>/**/CHANGES.html',
341+
'!<%= config.dist %>/**/README.html',
342+
'!<%= config.dist %>/**/p5_featured/**/*.html',
343+
'!<%= config.dist %>/**/learn/*.html',
344+
'!<%= config.dist %>/**/examples/*.html'
345+
],
346+
options: {
347+
ignore: [
348+
/^This document appears to be written in English/,
349+
/^Bad value https:/,
350+
/^Consider adding a lang attribute to the html/
351+
]
352+
}
353+
}
319354
}
320355
});
321356

322-
grunt.registerTask('update-version', function(){
357+
grunt.registerTask('update-version', function() {
323358
const done = this.async();
324359

325360
const version = require('./src/templates/pages/reference/data.json').project.version;
@@ -341,6 +376,7 @@ module.exports = function(grunt) {
341376
grunt.loadNpmTasks('grunt-file-append');
342377
grunt.loadNpmTasks('grunt-contrib-compress');
343378
grunt.loadNpmTasks('grunt-contrib-requirejs');
379+
grunt.loadNpmTasks('grunt-html');
344380

345381
// multi-tasks: collections of other tasks
346382
grunt.registerTask('server', [
@@ -358,33 +394,31 @@ module.exports = function(grunt) {
358394
grunt.registerTask('optimize', [
359395
'newer:imagemin',
360396
'concat:dist',
361-
// 'uncss',
362397
'postcss'
363398
]);
364399

365400
// i18n tracking task
366-
grunt.registerTask('i18n', function(){
401+
grunt.registerTask('i18n', function() {
367402
var done = this.async();
368-
require("./i18n.js")(done);
403+
require('./i18n.js')(done);
369404
});
370405

371-
// runs three tasks in order
406+
// runs tasks in order
372407
grunt.registerTask('build', [
373408
'update-version',
374409
'exec',
375410
'clean',
411+
'requirejs:yuidoc_theme',
376412
'requirejs',
377413
'copy',
378-
'assemble',
379414
'optimize',
415+
'assemble',
380416
'file_append',
381417
'compress',
382-
'i18n'
418+
'i18n',
419+
'htmllint'
383420
]);
384421

385422
// runs with just grunt command
386-
grunt.registerTask('default', [
387-
'build'
388-
]);
389-
423+
grunt.registerTask('default', ['build']);
390424
};

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@
44

55
## How To Contribute
66

7-
Known bugs and intended new features are tracked using [GitHub issues](https://github.com/processing/p5.js-website/issues). If you'd like to start working on an existing issue, comment on the issue that you plan to work on it so other contributors know it's being handled and can offer help. Once you have completed your work on this issue, [submit a pull request (PR)](https://github.com/processing/p5.js/blob/master/developer_docs/preparing_a_pull_request.md) against the p5.js master branch. In the description field of the PR, include "resolves #XXXX" tagging the issue you are fixing. If the PR addresses the issue but doesn't completely resolve it (ie the issue should remain open after your PR is merged), write "addresses #XXXX".
7+
Known bugs and intended new features are tracked using [GitHub issues](https://github.com/processing/p5.js-website/issues). If you'd like to start working on an existing issue, comment on the issue that you plan to work on it so other contributors know it's being handled and can offer help. Once you have completed your work on this issue, [submit a pull request (PR)](https://github.com/processing/p5.js/blob/master/contributor_docs/preparing_a_pull_request.md) against the p5.js master branch. In the description field of the PR, include "resolves #XXXX" tagging the issue you are fixing. If the PR addresses the issue but doesn't completely resolve it (ie the issue should remain open after your PR is merged), write "addresses #XXXX".
88

99
If you discover a bug or have an idea for a new feature you'd like to add, begin by submitting an issue. Please do not simply submit a pull request containing the fix or new feature without making an issue first, we will probably not be able to accept it. Once you have gotten some feedback on the issue and a go ahead to address it, you can follow the process above to add the fix or feature.
1010

1111
We recognize all types of contributions. This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Add yourself to the [p5.js repository readme](https://github.com/processing/p5.js/blob/master/README.md#contributors) by following the [instructions here](https://github.com/processing/p5.js/issues/2309)!
1212

13+
1314
## Setup
1415

15-
0. Install [node.js](https://nodejs.org/en/download/).
16-
1. Download this repo as a [zip file](https://github.com/processing/p5.js-website/archive/master.zip) or [clone this repository](https://help.github.com/articles/cloning-a-repository/).
17-
2. Navigate to the `p5.js-website` directory in the terminal and type `npm install`.
16+
0. Ensure Java is installed. Not installed? Head over to https://java.oracle.com
17+
1. Install [node.js](https://nodejs.org/en/download/).
18+
2. Download this repo as a [zip file](https://github.com/processing/p5.js-website/archive/master.zip) or [clone this repository](https://help.github.com/articles/cloning-a-repository/).
19+
3. Navigate to the `p5.js-website` directory in the terminal and type `npm install`.
1820

1921
## Running
2022

@@ -44,7 +46,6 @@ Once you've setup the site, type `npm run watch` to run the website. This should
4446

4547
If you've contributed to this website (or any other part of the p5.js project), add yourself [here](https://github.com/processing/p5.js#contributors). Instructions to do this can be found at the bottom of the section.
4648

47-
4849
## Etc
4950
* [Instructions for contributing to website translation/internationalization](https://github.com/processing/p5.js-website/blob/master/contributor_docs/i18n_contribution.md)
5051
* [Introducción a p5.js](https://github.com/processing/p5.js-getting-started-es) - The repository for the book and PDF production of [Introducción a p5.js](http://p5js.org/books/).

contributor_docs/Adding_examples.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ Examples help demonstrate different programming concepts and functionality of th
5454
4. [Grunt](https://gruntjs.com/) should now be installed, and you can use it to build the website by navigating to the top level directory and typing:
5555
5656
```bash
57-
grunt server
57+
npm run watch
5858
```
5959
6060
5. A local build of the p5js.org site should open in your web browser and you can navigate to the examples page to see your changes.

0 commit comments

Comments
 (0)