Skip to content

Instantly share code, notes, and snippets.

@nkreiger
Created August 21, 2023 21:37
Show Gist options
  • Save nkreiger/f5d0ce20a98fb8e0161b4750f3bb4f46 to your computer and use it in GitHub Desktop.
Save nkreiger/f5d0ce20a98fb8e0161b4750f3bb4f46 to your computer and use it in GitHub Desktop.
`public/config.js`
const config = (() => {
return {
"TEST_ONE": "hello",
"TEST_TWO": "world"
};
})();
`src/index.template.html`
<script src="config.js"></script>
`.eslintrc.js`
config: 'readable'
},
`.quasar.conf.js`
// https://quasar.dev/quasar-cli/handling-webpack
// "chain" is a webpack-chain object https://github.com/neutrinojs/webpack-chain
chainWebpack (chain) {
chain.module
.rule('custom-config')
.test(/config.*config\.js$/)
.use('file-loader')
.loader('file-loader')
.options({
name: 'config.js'
});
chain.plugin('eslint-webpack-plugin')
.use(ESLintPlugin, [{ extensions: [ 'js', 'vue' ] }])
},
`src/boot/env.js`
export const TEST_ONE = config.TEST_ONE
export const TEST_TWO = config.TEST_TWO
folder structure
src
boot
env.js
index.template.html
public
config.js
.eslintrc.js
Now you can use it anywhere :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment