ソースを参照

fix: import postcss from vue file

Gerald 8 年 前
コミット
cbc59365a0
5 ファイル変更31 行追加9 行削除
  1. 1 1
      scripts/vue-loader.conf.js
  2. 4 7
      src/options/app.js
  3. 22 0
      src/options/views/app.vue
  4. 0 1
      src/popup/app.js
  5. 4 0
      src/popup/views/app.vue

+ 1 - 1
scripts/vue-loader.conf.js

@@ -6,5 +6,5 @@ module.exports = {
     sourceMap: false,
     extract: isProduction,
   }),
-  postcss: [require('precss')],
+  postcss: [ require('precss') ],
 };

+ 4 - 7
src/options/app.js

@@ -2,9 +2,7 @@ import Vue from 'vue';
 import { sendMessage, i18n } from 'src/common';
 import options from 'src/common/options';
 import { store, features } from './utils';
-import Main from './views/main';
-import Confirm from './views/confirm';
-import './style.css';
+import App from './views/app';
 
 Vue.prototype.i18n = i18n;
 
@@ -30,11 +28,11 @@ initCustomCSS();
 
 const routes = {
   '': {
-    comp: Main,
+    comp: 'Main',
     init: initMain,
   },
   confirm: {
-    comp: Confirm,
+    comp: 'Confirm',
   },
 };
 window.addEventListener('hashchange', loadHash, false);
@@ -42,8 +40,7 @@ loadHash();
 
 options.ready(() => new Vue({
   el: '#app',
-  // store.route.comp should not change
-  render: h => h(store.route.comp),
+  render: h => h(App),
 }));
 
 function parseLocation(pathInfo) {

+ 22 - 0
src/options/views/app.vue

@@ -0,0 +1,22 @@
+<script>
+import { store } from '../utils';
+import Main from './main';
+import Confirm from './confirm';
+
+const components = {
+  Main,
+  Confirm,
+};
+
+export default {
+  render(h) {
+    // store.route.comp should not change
+    const comp = components[store.route.comp];
+    return h(comp);
+  },
+};
+</script>
+
+<style>
+@import '../style.css';
+</style>

+ 0 - 1
src/popup/app.js

@@ -3,7 +3,6 @@ import options from 'src/common/options';
 import { i18n, sendMessage } from 'src/common';
 import App from './views/app';
 import { store } from './utils';
-import './style.css';
 
 Vue.prototype.i18n = i18n;
 

+ 4 - 0
src/popup/views/app.vue

@@ -163,3 +163,7 @@ export default {
   },
 };
 </script>
+
+<style>
+@import '../style.css';
+</style>