Skip to content

Instantly share code, notes, and snippets.

@webrgp
Last active September 16, 2021 16:57
Show Gist options
  • Save webrgp/3c346c78d9cda43d6ef9322f924c2b0d to your computer and use it in GitHub Desktop.
Save webrgp/3c346c78d9cda43d6ef9322f924c2b0d to your computer and use it in GitHub Desktop.
Blendid Configuration for working with Twig
{
"src": "./src",
"dest": "./public",
"html": {
"src": "html",
"dest": "./"
},
"static": {
"src": "static",
"dest": "./"
},
"javascripts": {
"src": "javascripts",
"dest": "assets/javascripts"
},
"stylesheets": {
"src": "stylesheets",
"dest": "assets/stylesheets"
},
"images": {
"src": "images",
"dest": "assets/images"
},
"fonts": {
"src": "fonts",
"dest": "assets/fonts"
},
"icons": {
"src": "icons",
"dest": "assets/images"
}
}
const fs = require('fs')
const projectPath = require('blendid/gulpfile.js/lib/projectPath');
module.exports = {
images: true,
fonts: true,
static: true,
svgSprite: true,
ghPages: false,
html: {
dataFile: "_data/global.json",
extensions: ["html", "twig", "json", "svg"],
excludeFolders: ["_layouts", "_partials", "_macros", "_data"],
templateLanguage: "twig",
twig: {
errorLogToConsole: true,
},
dataFunction: function(file) {
const dataPath = projectPath(PATH_CONFIG.src, PATH_CONFIG.html.src, TASK_CONFIG.html.dataFile)
const data = JSON.parse(fs.readFileSync(dataPath, 'utf8'))
return {
'isDev': !global.production,
...data
}
}
},
stylesheets: {
autoprefixer: {
grid: true
}
},
javascripts: {
entry: {
// files paths are relative to
// javascripts.dest in path-config.json
app: ["./app.js"]
},
provide: {
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery"
}
},
browserSync: {
server: {
// should match `dest` in
// path-config.json
baseDir: 'public'
}
},
production: {
rev: false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment