Задать вопрос
Ответы пользователя по тегу Gulp.js
  • Не могу подключить скрипты в pug?

    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
    Ответ написан
    Комментировать