Browse Source

cria plugin para carregar THEME_CUSTOM em .env

pull/2485/head
Leandro Roberto 7 years ago
parent
commit
315002c1c3
  1. 2
      sapl-frontend/package.json
  2. 3
      sapl-frontend/src/hellow/router.js
  3. 12
      sapl-frontend/vue.config.js

2
sapl-frontend/package.json

@ -8,9 +8,11 @@
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint"
}, },
"dependencies": { "dependencies": {
"dotenv": "^6.2.0",
"vue": "^2.5.21", "vue": "^2.5.21",
"vue-router": "^3.0.1", "vue-router": "^3.0.1",
"vuex": "^3.0.1", "vuex": "^3.0.1",
"webpack": "^4.28.4",
"webpack-bundle-tracker": "^0.4.2-beta" "webpack-bundle-tracker": "^0.4.2-beta"
}, },
"devDependencies": { "devDependencies": {

3
sapl-frontend/src/hellow/router.js

@ -6,6 +6,5 @@ Vue.use(Router);
export default new Router({ export default new Router({
mode: "history", mode: "history",
base: process.env.BASE_URL, base: process.env.BASE_URL,
routes: [ routes: []
]
}); });

12
sapl-frontend/vue.config.js

@ -1,4 +1,8 @@
const webpack = require('webpack')
const BundleTracker = require('webpack-bundle-tracker') const BundleTracker = require('webpack-bundle-tracker')
const dotenv = require('dotenv')
dotenv.config({ path: '../sapl/.env' })
module.exports = { module.exports = {
publicPath: 'http://localhost:8080/', publicPath: 'http://localhost:8080/',
@ -32,10 +36,16 @@ module.exports = {
.add('./src/hellow/main.js') .add('./src/hellow/main.js')
.end() .end()
// then add your own
config.entry('theme') config.entry('theme')
.add('./src/theme/main.js') .add('./src/theme/main.js')
.end() .end()
config
.plugin('theme')
.use(webpack.DefinePlugin, [{
THEME_CUSTOM: JSON.stringify(process.env.THEME_CUSTOM)
}])
.end()
} }
} }

Loading…
Cancel
Save