M
M
mutaev_murad2018-11-01 20:02:55
HTML
mutaev_murad, 2018-11-01 20:02:55

Can't include scripts in pug?

Hello to all!
Can't include scripts in pug file
There is an index.pug file

Index.pug
extends pug/base
append vars

<b>Вот контент скрипты подключаю в самом конце</b>

block content
  include header <b>Тут подключен header</b>

  section.services
    .services__header
      .services__features
        .row.text-center
          .columns.small-12.large-expand
            .services__features-item
              .services__features-icon
                i.manage
              .services__features-text
                h2 Управление рабочим процессом
              .services__features-text
                p Поможет определить источники<br> звонков  и оценить прибыльность рекламных каналов
              a.button.hollow Подробнее про управление процессом

block scripts
  script(src='/js/vendor/config.js')

<b>Вот здесь как по идее подключаю скрипты</b>


Browser says
Loading script at " http://localhost:bla-bla/js/vendor/config.js" failed.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mutaev_murad, 2018-11-01
@mutaev_murad

There is also a base template base.pug

base.pug
include mixins/svg

block vars
  -
    var baseDir = '/'
  -
    var title = typeof title !== 'undefined' ? title : null
    var description = typeof description !== 'undefined' ? description : null
    var image = typeof image !== 'undefined' ? image : null
  -
    var html = {
      attrs: {
        lang: 'ru'
      },
      classList: []
    }
  -
    var body = {
      attrs: {},
      classList: []
    }
  -
    var meta = {
      appleMobileWebAppCapable: null,
    
      charset: 'utf-8',
      description: description,
      formatDetection: {
        address: true,
        date: true,
        email: true,
        telephone: true
      },
      keywords: [],
      msapplicationTileColor: null,
    
      ogDescription: description,
      ogImage: image,
      ogImageType: null,
      ogImageWidth: null,
      ogImageHeight: null,
      ogImageAlt: null,
      ogLocale: 'ru_RU',
      ogTitle: title,
      ogType: 'website',
      ogUrl: null,
      themeColor: null,
      twitterCard: 'summary_large_image',
      twitterSite: null,
      twitterCreator: null,
      twitterTitle: title,
      twitterDescription: description,
      twitterImage: image,
      viewport: 'width=device-width',
      XUACompatible: 'IE=edge'
    }
  -
    var link = {
      appleTouchIcon: null,
      appleTouchIcon40x40: null,
      appleTouchIcon57x57: null,
      
      icon: null,
      icon16x16: null,
      icon32x32: null,
      icon96x96: null,
      icon128x128: null,
      icon196x196: null,
      imageSrc: image,
      manifest: null,
      maskIcon: {
        href: null,
        color: null
      }
    }

doctype html
html(class=html.classList)&attributes(html.attrs)
  head
    block head-start
    block meta
      if meta.charset !== null
        meta(charset=meta.charset)
    
        meta(name="theme-color" content=meta.themeColor)
      if meta.formatDetection !== null && (typeof meta.formatDetection === 'string' || Object.values(meta.formatDetection).some(function (value) { return !value }))
        meta(name="format-detection" content=(typeof meta.formatDetection === 'string' ? meta.formatDetection : Object.entries(meta.formatDetection).filter(function (entry) { return !entry[1] || entry[1] === 'no' }).map(function (entry) { return `${entry[0]}=no` }).join(',')))
    if title !== null
      title= title
    block links
      if link.appleTouchIconPrecomposed !== null
        link(rel="apple-touch-icon-precomposed" href=link.appleTouchIconPrecomposed)
      if link.appleTouchIconPrecomposed40x40 !== null
        link(rel="apple-touch-icon-precomposed" href=link.appleTouchIconPrecomposed40x40 sizes="40x40")
    
      if link.maskIcon.href !== null
        link(rel="mask-icon" href=link.maskIcon.href color=link.maskIcon.color)
    block styles
      link(rel="stylesheet" href=`css/main.css?v=${Date.now()}`)
    block head-end
  body(class=body.classList)&attributes(body.attrs)
    block body-start
    block content
    block scripts
      script(src=`${baseDir}js/vendor.js?v=${Date.now()}`)
      script(src=`${baseDir}js/main.js?v=${Date.now()}`)
      


    block body-end

At the very end there is a scripts block

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question