From 0dc3329f7a540459e7a4a045e2f5211dee892ff2 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 22 Apr 2020 10:54:35 +0200 Subject: [PATCH] Add base VueJS configuration --- .gitignore | 19 ++++++++---- package.json | 50 +++++++++++++++++++++++++++++++ static/components/HelloWorld.vue | 20 +++++++++++++ static/components/HelloWorld2.vue | 21 +++++++++++++ vue.config.js | 23 ++++++++++++++ 5 files changed, 127 insertions(+), 6 deletions(-) create mode 100644 package.json create mode 100644 static/components/HelloWorld.vue create mode 100644 static/components/HelloWorld2.vue create mode 100644 vue.config.js diff --git a/.gitignore b/.gitignore index c978acac..da8f360e 100644 --- a/.gitignore +++ b/.gitignore @@ -27,20 +27,27 @@ venv/ ENV/ env.bak/ venv.bak/ +node_modules -# Spyder project settings +# Editor directories and files +.ropeproject .spyderproject .spyproject +.idea +.vscode +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? -# Rope project settings -.ropeproject - -# PyCharm project settings -.idea/ +# Do not pin versions +yarn.lock # Django statics static_files/ static/logo/ +static/bundles/ # re2o specific settings_local.py diff --git a/package.json b/package.json new file mode 100644 index 00000000..b76b165b --- /dev/null +++ b/package.json @@ -0,0 +1,50 @@ +{ + "name": "re2o", + "private": true, + "repository": "git@gitlab.federez.net:re2o/re2o.git", + "license": "GPL-3.0+", + "scripts": { + "build": "vue-cli-service build --inline-vue --target wc-async 'static/components/*.vue'", + "lint": "vue-cli-service lint" + }, + "dependencies": { + "core-js": "^3.6.4", + "vue": "^2.6.11" + }, + "devDependencies": { + "@vue/cli-plugin-babel": "~4.3.0", + "@vue/cli-plugin-eslint": "~4.3.0", + "@vue/cli-service": "~4.3.0", + "babel-eslint": "^10.1.0", + "eslint": "^6.7.2", + "eslint-plugin-vue": "^6.2.2", + "sass": "^1.26.3", + "sass-loader": "^8.0.2", + "vue-template-compiler": "^2.6.11", + "webpack-bundle-tracker": "^1.0.0-alpha.1" + }, + "babel": { + "presets": [ + "@vue/cli-plugin-babel/preset" + ] + }, + "eslintConfig": { + "root": true, + "env": { + "node": true + }, + "extends": [ + "plugin:vue/essential", + "eslint:recommended" + ], + "parserOptions": { + "parser": "babel-eslint" + }, + "rules": {} + }, + "browserslist": [ + "> 1%", + "last 2 versions", + "not dead" + ] +} \ No newline at end of file diff --git a/static/components/HelloWorld.vue b/static/components/HelloWorld.vue new file mode 100644 index 00000000..5b862c70 --- /dev/null +++ b/static/components/HelloWorld.vue @@ -0,0 +1,20 @@ + + + + + + diff --git a/static/components/HelloWorld2.vue b/static/components/HelloWorld2.vue new file mode 100644 index 00000000..6e663501 --- /dev/null +++ b/static/components/HelloWorld2.vue @@ -0,0 +1,21 @@ + + + + + + \ No newline at end of file diff --git a/vue.config.js b/vue.config.js new file mode 100644 index 00000000..1bc95a83 --- /dev/null +++ b/vue.config.js @@ -0,0 +1,23 @@ +/** + * Re2o VueJS configuration + * + * Each VueJS components in static/components are compiled into asynchronous + * chunks in static/bundles. + * Then you can use for exemple to call + * the HelloWorld component. + */ + +const BundleTracker = require("webpack-bundle-tracker"); + +module.exports = { + // Output to Django statics + outputDir: './static/bundles/', + + // Customize Webpack + chainWebpack: config => { + // Create file for django-webpack-loader + config + .plugin('BundleTracker') + .use(BundleTracker, [{ filename: './webpack-stats.json' }]) + } +}; \ No newline at end of file