mutaev_murad
@mutaev_murad

Не могу подключить скрипты в pug?

Привет Всем!
Не могу подключить скрипты в pug файл
Есть файл index.pug

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>


В браузере пишет

Загрузка script по адресу «http://localhost:bla-bla/js/vendor/config.js» не удалась.

  • Вопрос задан
  • 1004 просмотра
Пригласить эксперта
Ответы на вопрос 1
mutaev_murad
@mutaev_murad Автор вопроса
Есть также базовый шаблон 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



В самом конце есть блок scripts
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы