FlowRouter добавляет префикс URL (маршрут) ко всем ссылкам - PullRequest
0 голосов
/ 31 мая 2018

Последняя версия Meteor JS ломает FlowRouter или последняя версия FlowRouter ломает Meteor JS, я не могу найти одну из двух, вызывающую проблему Meteor Js Я хотел начать новый проект с использованием Meteor и staringatlights: flow-router

staringatlights:flow-router
kadira:blaze-layout

У меня FlowRouter настроен следующим образом:

   var public = FlowRouter.group();

    public.route('/', {
      name: 'home', action(){
        BlazeLayout.render('MainLayout', {main: 'home'});
      }
    });

    var authusers = FlowRouter.group({
        prefix: '/private',
        name: 'authusers'
    });

    authusers.route('/dashboard', {
        name: 'dashboard', action(){
            BlazeLayout.render('DashboardLayout', {dashboards: 'dashboard'});
        }
    });

У меня есть макет для других шаблонов.Ссылки CSS и JS находятся в общей папке.Я использую шаблон, я не знаю причину, по которой FlowRouter добавляет префикс маршрута ко всем этим ссылкам.

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta http-equiv="x-ua-compatible" content="ie=edge">

  <title>OL' Tega</title>
  <link rel="stylesheet" href="themes/adminlte3/plugins/font-awesome/css/font-awesome.min.css">
  <link rel="stylesheet" href="themes/adminlte3/dist/css/adminlte.min.css">
  <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
</head>

<template name="DashboardLayout">


    {{> Template.dynamic template=dashboards}}

<script src="themes/adminlte3/plugins/jquery/jquery.min.js"></script>
<script src="themes/adminlte3/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="themes/adminlte3/dist/js/adminlte.js"></script>
<script src="themes/adminlte3/dist/js/demo.js"></script>
<script src="themes/adminlte3/plugins/sparkline/jquery.sparkline.min.js"></script>
<script src="themes/adminlte3/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
<script src="themes/adminlte3/plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
<script src="themes/adminlte3/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="themes/adminlte3/plugins/chartjs-old/Chart.min.js"></script>
<script src="themes/adminlte3/dist/js/pages/dashboard2.js"></script>
</template>

Это ошибка, которую я получаю.Это не.Маршрутизатор добавляет префикс маршрута ко всем ссылкам.

Refused to apply style from 'http://localhost:3000/private/themes/adminlte3/plugins/font-awesome/css/font-awesome.min.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
dashboard:1 Refused to apply style from 'http://localhost:3000/private/themes/adminlte3/dist/css/adminlte.min.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
10Refused to execute script from '<URL>' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to execute script from 'http://localhost:3000/private/themes/adminlte3/plugins/jquery/jquery.min.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to execute script from 'http://localhost:3000/private/themes/adminlte3/plugins/bootstrap/js/bootstrap.bundle.min.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to execute script from 'http://localhost:3000/private/themes/adminlte3/dist/js/adminlte.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to execute script from 'http://localhost:3000/private/themes/adminlte3/dist/js/demo.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to execute script from 'http://localhost:3000/private/themes/adminlte3/plugins/sparkline/jquery.sparkline.min.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to execute script from 'http://localhost:3000/private/themes/adminlte3/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to execute script from 'http://localhost:3000/private/themes/adminlte3/plugins/jvectormap/jquery-jvectormap-world-mill-en.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to execute script from 'http://localhost:3000/private/themes/adminlte3/plugins/slimScroll/jquery.slimscroll.min.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to execute script from 'http://localhost:3000/private/themes/adminlte3/plugins/chartjs-old/Chart.min.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to execute script from 'http://localhost:3000/private/themes/adminlte3/dist/js/pages/dashboard2.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to apply style from 'http://localhost:3000/private/themes/adminlte3/plugins/font-awesome/css/font-awesome.min.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
dashboard:1 Refused to apply style from 'http://localhost:3000/private/themes/adminlte3/dist/css/adminlte.min.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.

1 Ответ

0 голосов
/ 04 июня 2018

Я полагаю, что это потому, что ваши URL-адреса являются относительными, и поэтому браузер берет текущий URL-адрес и добавляет к нему путь ссылки.

Чтобы решить эту проблему, используйте добавить начальную косую черту, чтобы она стала относительнойв домен, а не текущую страницу.Например:

<script src="/themes/adminlte3/plugins/jquery/jquery.min.js"></script>
<script src="/themes/adminlte3/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="/themes/adminlte3/dist/js/adminlte.js"></script>
<script src="/themes/adminlte3/dist/js/demo.js"></script>
<script src="/themes/adminlte3/plugins/sparkline/jquery.sparkline.min.js"></script>
<script src="/themes/adminlte3/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
<script src="/themes/adminlte3/plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
<script src="/themes/adminlte3/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="/themes/adminlte3/plugins/chartjs-old/Chart.min.js"></script>
<script src="/themes/adminlte3/dist/js/pages/dashboard2.js"></script>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...