Skip to content

Instantly share code, notes, and snippets.

@alsolovyev
Last active March 30, 2021 20:28
Show Gist options
  • Select an option

  • Save alsolovyev/d8701baf98ef24fd68f02b7ebb2472c1 to your computer and use it in GitHub Desktop.

Select an option

Save alsolovyev/d8701baf98ef24fd68f02b7ebb2472c1 to your computer and use it in GitHub Desktop.
Parcel config files for nunjucks templates

Parcel config files for nunjucks templates

  1. Change yarn vesrion:
    yarn set version berry
  2. Install dependencies:
    yarn add -D babel-types nunjucks parcel-bundler parcel-plugin-data-src parcel-plugin-nunjucks parcel-plugin-svg-sprite sass
  3. Run dev:
    yarn start
module.exports = {
'data': `$isDev: ${process.env.NODE_ENV === 'development'}`,
'includePaths': ['node_modules']
}
# Distribution folder
dist/
# Yarn 2
.yarn/
.pnp.js
.yarnrc.yml
# Dependency directories
node_modules/
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
const data = require('./src/data')
module.exports = {
root: './src',
data: {
...data,
isDev: process.env.NODE_ENV === 'development'
}
}
{
"private": true,
"scripts": {
"start": "yarn dev",
"dev": "parcel ./src/index.njk --port 8080 --cache-dir /mnt/d/Junk/parcel-cache",
"clean": "yarn clean:cache",
"clean:cache": "rm -rf /mnt/d/Junk/parcel-cache"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment