2015-03-25 4 views
4

Я пытаюсь добавить файл route.js в layout.ejs.Невозможно добавить скрипты в layout.ejs (sails.js)

<!DOCTYPE html> 
<html ng-app="scratchpad"> 
    <head> 
    <title>Scratchpad</title> 

    <!-- Viewport mobile tag for sensible mobile support --> 
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> 


    <!-- 
     Stylesheets and Preprocessors 
     ============================== 

     You can always bring in CSS files manually with `<link>` tags, or asynchronously 
     using a solution like AMD (RequireJS). Or, if you like, you can take advantage 
     of Sails' conventional asset pipeline (boilerplate Gruntfile). 

     By default, stylesheets from your `assets/styles` folder are included 
     here automatically (between STYLES and STYLES END). Both CSS (.css) and LESS (.less) 
     are supported. In production, your styles will be minified and concatenated into 
     a single file. 

     To customize any part of the built-in behavior, just edit `tasks/pipeline.js`. 
     For example, here are a few things you could do: 

      + Change the order of your CSS files 
      + Import stylesheets from other directories 
      + Use a different or additional preprocessor, like SASS, SCSS or Stylus 
    --> 
    <!--Twitter Bootstrap--> 
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"> 
    <!--Twitter Bootstrap END--> 
    <!--STYLES--> 
    <link rel="stylesheet" href="/styles/border.css"> 
    <link rel="stylesheet" href="/styles/tablerow.css"> 
    <!--STYLES END--> 
    </head> 

    <body> 
    <nav class = "navbar navbar-default" role = "navigation"> 
     <div class = "container-fluid"> 
     <div class = "navbar-header"> 
      <a class = "navbar-brand" ui-sref = "scratchpad">MY SCRATCHPAD</a> 
     </div> 
     </div> 

    </nav> 


    <p>hello world</p> 

    <div class = "container"> 
     <div ui-view></div> 
    </div> 

    <!--SCRIPTS--> 
    <script src="/js/dependencies/sails.io.js"></script> 
    <script src="/js/dependencies/bower_components/jquery/dist/jquery.min.js"></script> 
    <script src="/js/dependencies/bower_components/angular/angular.min.js"></script> 
    <script src="/js/dependencies/bower_components/angular-resource/angular-resource.min.js"></script> 
    <script src="/js/dependencies/bower_components/angular-ui-router/release/angular-ui-router.min.js"></script> 
    <script src="/js/dependencies/bower_components/moment/moment.js"></script> 
    <script src="/js/dependencies/application.js"></script> 
    <script src="/js/dependencies/route.js"></script> 

    <!--SCRIPTS END--> 
    </body> 
</html> 

Всякий раз, когда я добавляю это и сохраняю его. Его спасло. Но когда я пытаюсь запустить sails lift. Сценарий route.js исчезает, и файл layout.ejs переходит в старое состояние. Кто-нибудь может это понять? Любая идея о том, что может быть ошибкой? причина ворчания?

+0

Является ли ваша проблема изменением фактического файла layout.ejs. Это означает, что вы вернулись и переделали layout.ejs? – Meeker

ответ

5

До тех пор, как я помню, все внутри

<!--SCRIPTS--> 
... 

<!--SCRIPTS END--> 

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

<!--SCRIPTS--> 
<script src="/js/dependencies/sails.io.js"></script> 
<script src="/js/dependencies/bower_components/jquery/dist/jquery.min.js"></script> 
<script src="/js/dependencies/bower_components/angular/angular.min.js"></script> 
<script src="/js/dependencies/bower_components/angular-resource/angular-resource.min.js"></script> 
<script src="/js/dependencies/bower_components/angular-ui-router/release/angular-ui-router.min.js"></script> 
<script src="/js/dependencies/bower_components/moment/moment.js"></script> 
<script src="/js/dependencies/application.js"></script> 
<!--SCRIPTS END--> 
<script src="/js/dependencies/route.js"></script> 
+0

Эй, спасибо за ответ. – divakar

Смежные вопросы