Skip to content

Commit 655e7f0

Browse files
author
Zhou
committed
enable less; jest tested;
1 parent 31d77a8 commit 655e7f0

File tree

13 files changed

+441
-97
lines changed

13 files changed

+441
-97
lines changed

ReadMe.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,25 @@ The initial work of Planimation JS Library, and the frontend is waiting to be de
1212
- [RequireJS] - RequireJS is a JavaScript file and module loader
1313

1414
## Run the demo
15-
In the root folder:
16-
```sh
17-
npm install http-server -g
18-
http-server
15+
Open the working directory with VS code, in the terminal:
16+
```
17+
yarn //or “npm install”
18+
```
19+
This command will automatically install all the packages you need in this project.
20+
21+
Run the demo:
22+
```
23+
npm run start
24+
```
25+
This will open a page on your browser, and you should see a jumping rabbit like this:
26+
27+
28+
29+
Now, the development environment is all set up! Start coding😊
30+
31+
Test your code:
32+
```
33+
yarn test //or “npm test”
1934
```
2035
Open the link in your browser, and you should see a visualisation of block world .
2136

@@ -33,6 +48,8 @@ When you develop the new features for Planimation JS Libary, please try to modul
3348
* Pixi JS - https://www.pixijs.com/
3449
* Pixi JS Tutorial - https://github.com/kittykatattack/learningPixi
3550
* Pixi JS Demos - https://pixijs.io/examples/#/demos-basic/container.js
51+
* ReactPixi - https://reactpixi.org/
52+
* React - https://reactjs.org/docs/getting-started.html
3653

3754
[PIXIJS]: <https://www.pixijs.com/>
3855
[RequireJS]:<https://requirejs.org/>

config/webpack.config.js

Lines changed: 6 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,11 @@ const useTypeScript = fs.existsSync(paths.appTsConfig);
5959
const swSrc = paths.swSrc;
6060

6161
// style files regexes
62-
const cssRegex = /\.css$/;
63-
const cssModuleRegex = /\.module\.css$/;
62+
const cssRegex = /\.(css|less)$/;
63+
const cssModuleRegex = /\.module\.(css|less)$/;
6464
const sassRegex = /\.(scss|sass)$/;
6565
const sassModuleRegex = /\.module\.(scss|sass)$/;
6666

67-
const lessRegex = /\.less$/;
68-
const lessModuleRegex = /\.module\.less$/;
69-
7067
const hasJsxRuntime = (() => {
7168
if (process.env.DISABLE_NEW_JSX_TRANSFORM === 'true') {
7269
return false;
@@ -474,11 +471,13 @@ module.exports = function (webpackEnv) {
474471
test: cssRegex,
475472
exclude: cssModuleRegex,
476473
use: getStyleLoaders({
477-
importLoaders: 1,
474+
importLoaders: 2,
475+
modules: true,
478476
sourceMap: isEnvProduction
479477
? shouldUseSourceMap
480478
: isEnvDevelopment,
481-
}),
479+
},
480+
"less-loader"),
482481
// Don't consider CSS imports dead code even if the
483482
// containing package claims to have no side effects.
484483
// Remove this when webpack adds a warning or an error for this.
@@ -537,30 +536,6 @@ module.exports = function (webpackEnv) {
537536
'sass-loader'
538537
),
539538
},
540-
{
541-
test: lessRegex,
542-
exclude: sassModuleRegex,
543-
use: getStyleLoaders(
544-
{
545-
importLoaders: 2,
546-
sourceMap: isEnvProduction && shouldUseSourceMap,
547-
},
548-
'less-loader'
549-
),
550-
sideEffects: true,
551-
},
552-
{
553-
test: lessModuleRegex,
554-
use: getStyleLoaders(
555-
{
556-
importLoaders: 2,
557-
sourceMap: isEnvProduction && shouldUseSourceMap,
558-
modules: true,
559-
getLocalIdent: getCSSModuleLocalIdent,
560-
},
561-
'less-loader'
562-
),
563-
},
564539
// "file" loader makes sure those assets get served by WebpackDevServer.
565540
// When you `import` an asset, you get its (virtual) filename.
566541
// In production, they would get copied to the `build` folder.

jsconfig.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"compilerOptions": {
3+
"experimentalDecorators": true,
4+
"baseUrl": "./",
5+
"paths": {
6+
"@/*": ["src/*"],
7+
"components/*": ["src/components/*"],
8+
"pages/*": ["src/pages/*"]
9+
}
10+
},
11+
"exclude": ["node_modules", "dist"]
12+
}

0 commit comments

Comments
 (0)