Is it possible to import css file conditionally in Vue.js?
问题 I have my admin-panel and pages for clients in one Vue.js project . Is it possible to use certain css-files only if the current route has "forAdmin" meta? 回答1: By using style-loader with the useable API, you can dynamically apply and remove a stylesheet in your code. First you'll need to update your webpack config rules so that stylesheets with the .useable.css extension will be loaded with the useable API: { test: /\.css$/, exclude: /\.useable.css$/, use: [ 'style-loader', 'css-loader' ] },