-
Notifications
You must be signed in to change notification settings - Fork 0
minifyJS
Reuben L. Lillie edited this page Jul 22, 2019
·
2 revisions
The minifyJS() filter optimizes and loads a JavaScript file inline.
Code resides in filters/minify-js.js where there is more technical inline documentation.
To use minifyJS() as a universal filter in 11ty, make sure you install Mihai Bazon’s uglify-es module.
~$ npm install --save uglify-es
Call this.minifyJS() wherever you can load an inline script.
// layout.11ty.js
module.exports = function (data) {
return `
<!DOCTYPE>
<html>
<head>
…
</head>
<body>
…
<script>
${this.minifyJS(this.fileToString('/includes/assets/js/script.js'))}
</script>
</body>
</html>`
}Copyright © 2019 by Pittsburgh District Church of the Nazarene
- Welcome
- Setup
- Coding Standards
-
HTML (in
/pghnaz.org/wiki) -
CSS (in
/pghnaz.org/wiki) -
JavaScript (in
/pghnaz.org/wiki)
-
HTML (in
- Color Scheme
- Style Guide
- Layouts
404.11ty.jsbase.11ty.jscalendar.11ty.jscontact.11ty.jscontent.11ty.jscollection.11ty.jseventList.11ty.jsmap.11ty.jssearch.11ty.js
- Filters
- Shortcodes
- Site Information
affiliateLogo()copyrightNotice()favicon()rootDomainLogo()siteLogo()siteTagline()
- Document metadata
descriptionMeta()contentDate()contentTitle()externalCSS()headTag()inlineCSS()socialMeta()titleTag()
- Navigation
menu()socialLinks()
- Headers
contentHeader()siteHeader()
- Footers
contentFooter()siteFooter()
- Call to Action
callToAction()editThisPage()subscribeToNewsletter()
- Site Information
- Client-Side JavaScript
search.js
- Other static assets
- Badges
- Branding
- Fonts