GithubHelp home page GithubHelp logo

Pug support about gridsome HOT 8 CLOSED

gridsome avatar gridsome commented on June 22, 2024
Pug support

from gridsome.

Comments (8)

hjvedvik avatar hjvedvik commented on June 22, 2024 6

Sorry, I just notices there is a bug with chainWebpack in v0.3.. Will have that fixed asap :) But you can create a gridsome.server.js file and use the server API instead. The Vue Loader uses the .pug config when parsing Pug templates in SFC.

module.exports = function (api) {
  api.chainWebpack(config => {
    config.module
      .rule('pug')
      .test(/\.pug$/)
      .use('pug-plain-loader')
        .loader('pug-plain-loader')
  })
}

from gridsome.

Doogiemuc avatar Doogiemuc commented on June 22, 2024 4

Just for reference if anyone else googles this: https://github.com/gluons/gridsome-plugin-pug

from gridsome.

hjvedvik avatar hjvedvik commented on June 22, 2024 2

Hi, you can use chainWebpack in your gridsome.config.js file to add the pug loader :)

module.exports = {
  chainWebpack: config => {
    config.module
      .rule('pug')
      .test(/\.pug$/)
      .use('pug-plain-loader')
        .loader('pug-plain-loader')
  }
}

from gridsome.

lobo-tuerto avatar lobo-tuerto commented on June 22, 2024 1

That works, thanks!

Little typo:

api.chainWebpak => api.chainWebpack

from gridsome.

lobo-tuerto avatar lobo-tuerto commented on June 22, 2024

Hello, I'm still seeing the same error, I'm not using .pug files, but .vue files.

For example:

src/pages/About.vue:

<template lang="pug">
layout
  h1 About us
  p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Error doloremque omnis animi, eligendi magni a voluptatum, vitae, consequuntur rerum illum odit fugit assumenda rem dolores inventore iste reprehenderit maxime! Iusto.
</template>

This is my current gridsome.config.js:

module.exports = {
  chainWebpack: config => {
    config.module
      .rule('pug')
      .test(/\.(pug|vue)$/)
      .use('pug-plain-loader')
      .loader('pug-plain-loader')
  },
  plugins: [
    {
      use: '@gridsome/source-filesystem',
      options: {
        path: 'blog/**/*.md',
        typeName: 'Post',
        route: '/blog/:slug'
      }
    }
  ]
}

I'm using Pug inside SFC Vue files.

from gridsome.

lobo-tuerto avatar lobo-tuerto commented on June 22, 2024

I'm reopening this, since this is related to an upcoming fix.

from gridsome.

lobo-tuerto avatar lobo-tuerto commented on June 22, 2024

Closing this as it's been fixed by: 2cc5850

from gridsome.

gringolalia avatar gringolalia commented on June 22, 2024

thank you @hjvedvik that was it in my case ...

from gridsome.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.