Add Babel JavaScript compiler

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2020-09-02 20:19:40 -03:00
parent e1461d847c
commit 307b0d2923
77 changed files with 1800 additions and 18 deletions

3
babel.config.json Normal file
View File

@ -0,0 +1,3 @@
{
"presets": ["@babel/preset-env"]
}

2
js/dist/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
/*
!/.gitignore

View File

@ -37,6 +37,9 @@
"zxcvbn": "4.4.2"
},
"devDependencies": {
"@babel/cli": "^7.11.5",
"@babel/core": "^7.11.5",
"@babel/preset-env": "^7.11.5",
"eslint": "^7.5.0",
"eslint-plugin-compat": "^3.8.0",
"eslint-plugin-no-jquery": "^2.5.0",
@ -50,9 +53,10 @@
"lodash": "^4.17.19"
},
"scripts": {
"postinstall": "yarn run --silent css-compile --quiet --style=compressed",
"postinstall": "yarn run --silent css-compile --quiet --style=compressed && yarn run --silent js-compile --quiet",
"css-compile": "sass themes/pmahomme/scss:themes/pmahomme/css themes/original/scss:themes/original/css themes/metro/scss:themes/metro/css themes/bootstrap/scss:themes/bootstrap/css",
"css-lint": "stylelint --syntax scss \"themes/**/scss/*.scss\"",
"js-lint": "eslint js"
"js-lint": "eslint js/src",
"js-compile": "babel js/src -d js/dist"
}
}

View File

@ -1,5 +1,6 @@
{% for file in files %}
<script data-cfasync="false" type="text/javascript" src="{{ base_dir }}js/{{ file.filename }}
<script data-cfasync="false" type="text/javascript" src="{{ base_dir }}js/
{{- file.filename starts with 'vendor/' ? file.filename : 'dist/' ~ file.filename -}}
{{- '.php' in file.filename ? get_common(file.params|merge({'v': version})) : '?v=' ~ version|url_encode }}"></script>
{% endfor %}

1802
yarn.lock

File diff suppressed because it is too large Load Diff