Jump to content
  • 0

jade(pug) in gulp


Schamil74
 Share

Question

Всем привет!

Сам не могу справится.

Подправьте, пожалуйста, галпфайл, нужно добавить jade(pug).

Структура файлов во вложении.

Сейчас index.html и creamy.html собираются из кусков из папки template с помощью rigger.

 

gulpfile.js

Screenshot from 2017-02-12 01-15-17.png

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

А в чем проблема у вас? Таск в галпфайле будет примерно такой:

gulp.task(pages);

function pages() {
  // Pug settings
  const settings = {};
  
  return gulp.src(`${config.paths.source.pug}/*.pug`)
  	.pipe(gulp.pug(settings))
  
  /... maybe something else .../
  
  	.pipe(gulp.dest(config.paths.dest.html));
}

Сами .pug-файлы, конечно, изменяться. Структура может быть такой, например

├── pages
    ├── index.pug
    └── templates
        └── layout.pug

Пример для layout.pug:

doctype html
html
    head
        meta(charset='utf-8')
        meta(name='viewport', content='width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0')
        meta(http-equiv='X-UA-Compatible', content='ie=edge')

        block title
            title Untitled

        link(rel='stylesheet', href='./css/main.built.css')

    body
        block content

Пример для index.pug:

extends ./templates/layout.pug

block title
    title Index page

block content
    //content will be here

    //script(src='/js/app.js')

Или используйте includes.

Вообще, документация у них вполне нормальная, с большим количеством примеров.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy