Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 19 10:20

    Scrum on master

    test: migrate to ES6 Merge pull request #338 from Su… (compare)

  • Oct 19 10:20
    Scrum closed #338
  • Oct 17 17:04
    SukkaW review_requested #338
  • Oct 15 08:22
    SukkaW synchronize #338
  • Oct 15 06:57
    Scrum review_request_removed #338
  • Oct 15 06:57
    Scrum review_requested #338
  • Oct 15 06:57
    Scrum review_request_removed #338
  • Oct 15 06:47
    SukkaW review_requested #338
  • Oct 15 06:47
    SukkaW review_requested #338
  • Oct 15 06:47
    SukkaW review_requested #338
  • Oct 15 06:47
    SukkaW review_requested #338
  • Oct 15 06:47
    SukkaW opened #338
  • Oct 15 06:31

    Scrum on master

    docs: change test status (compare)

  • Oct 15 06:29

    Scrum on milestone-0.13.4

    (compare)

  • Oct 15 06:29

    Scrum on master

    ci: change travis to github act… 0.13.4 Merge pull request #337 from po… (compare)

  • Oct 15 06:29
    Scrum closed #337
  • Oct 15 06:29
    coveralls commented #337
  • Oct 15 06:29
    coveralls commented #337
  • Oct 15 06:29
    coveralls commented #337
  • Oct 15 06:28
    Scrum synchronize #337
Ivan Voischev
@voischev
Jitendra Vyas
@jitendravyas
It’s not working for me cc @voischev
Jitendra Vyas
@jitendravyas
after this setup when i run gulp html it doesn’t add index.html file in dest folder
Jitendra Vyas
@jitendravyas
Michael Ciniawsky
@michael-ciniawsky

@jitendravyas

error.js

npm i -D gulp-util gulp-notify
const util = require('gulp-util')
const notify = require('gulp-notify')

module.exports = function (err) {
  let line = (err.lineNumber) ? 'LINE: ' + err.lineNumber + ' -- ' : ''
  notify({
    title: 'Task [' + err.plugin + '] failed',
    message: line + 'See console...',
    sound: 'Sosumi'
  })
  .write(err)

  util.beep()

  // Error reporting
  let report = ''
  let reporter = util.colors.red

  report += '\n'
  report += reporter(`[${Date.now()}] PLUGIN:`) + ' ' + err.plugin + '\n'
  report += reporter(`[${Date.now()}] ERROR:`) + '  ' + err.message + '\n'

  if (err.lineNumber) {
    report += reporter(`[${Date.now()}] LINE:`) + '   ' + err.lineNumber + '\n'
  }

  if (err.fileName) {
    report += reporter(`[${Date.now()}] FILE:`) + '   ' + err.fileName + '\n'
  }

  console.error(report)

  // Prevent the 'watch' task from stopping
  // this.emit('end')
}

posthtml.js

var error = require('./error.js')
....
.pipe(posthtml())
.on('error', (err) => error(err)) // add the error reporter with this line, if lazy replace with console.log(err) :)
and then please show the error and your index.html aswell, does it use poshtml-include 'already' to import components? If so, you need to setup gulp-tap to propagate the correct file.path to posthtml-include
Michael Ciniawsky
@michael-ciniawsky
import tap from 'gulp-tap'
import posthtml from 'gulp-posthtml'
import { task, src, dest } from 'gulp'

task('html', () => {
  let path

  const plugins = [ require('posthtml-include')({ root: `${path}/components/` }) ]
  const options = {}

  src('src/**/*.html')
    .pipe(tap((file) => path = file.path))
    .pipe(posthtml(plugins, options))
    .pipe(dest('build/'))
})
Michael Ciniawsky
@michael-ciniawsky
@jitendravyas working now? 😛
Jitendra Vyas
@jitendravyas
@michael-ciniawsky Thanks for reply. I will check this in morning tomorrow. Thanks for all the suggestions
Michael Ciniawsky
@michael-ciniawsky
@jitendravyas kk, if you get stuck make a test repo and share the link here, not sure if e.g include({ root : `{path}/components/` }) is 100% accurate (with final slash, yes/no, all that shit :)), i'm working on handling file.path within gulp-posthtml itself, so plugin options can be static and relative to the current file processing include({ root: 'components' }) done.... The current behaviour is definitely a pain point.
Jitendra Vyas
@jitendravyas
Does PostHTML have templates?
Michael Ciniawsky
@michael-ciniawsky
@jitendravyas posthtml-expressions (plugin) or poshtml-pug (parser) with option.locals
Michael Ciniawsky
@michael-ciniawsky
@jitendravyas does gulp work now ?
Jitendra Vyas
@jitendravyas
@michael-ciniawsky I did not try that again as I had to switch to Nujucks coz I needed template support.
Jitendra Vyas
@jitendravyas
@michael-ciniawsky can you give me an example of how to use template in PostHTML like this
{% extends "parent.html" %}

{% block left %}
This is the left side!
{% endblock %}

{% block right %}
This is the right side!
{% endblock %}
Jeff Escalante
@jescalan
@jitendravyas https://github.com/posthtml/posthtml-extend should do the trick for you
Jitendra Vyas
@jitendravyas
@jescalan looks like but I don’t want to keep my content in JS file
Jeff Escalante
@jescalan
you dont have to keep the content in a js file
you have the content and the layouts both in html files
Jitendra Vyas
@jitendravyas
Is it possible to use https://www.npmjs.com/package/gulp-data with PostHTML to keep content separate from markup?
Jeff Escalante
@jescalan
@jitendravyas you can use this plugin: https://github.com/posthtml/posthtml-expressions
if you are using, for example, json -- require the json file then pass it in as locals
Jitendra Vyas
@jitendravyas
Thanks @jescalan
I wonder if anyone using PostHTML in actual app
Jeff Escalante
@jescalan
I'm sure they are!
I am using reshape on a number of large production sites, which is very similar to posthtml, so its definitely feasible :)
Jitendra Vyas
@jitendravyas
what is reshape?
Jeff Escalante
@jescalan
a slightly different version of posthtml that also produces client-side templates. it's very similar though, so surely posthtml would also work in production without issue
Jitendra Vyas
@jitendravyas
Nice I didn’t know that. So which one is better PostHTML or Reshape.
How similar or different they are
Jeff Escalante
@jescalan
thats a very opinion-based question, you'd have to try it out yourself!
Jitendra Vyas
@jitendravyas
it seems posthtml have more plugins
Jeff Escalante
@jescalan
definitely true!
Jitendra Vyas
@jitendravyas
Is there something like Stylelint for HTML?
I want to force team members to push HTML with specific rules sets
If rule doesn’t match they should not be able to commit/push code
Michael Ciniawsky
@michael-ciniawsky
@jitendravyas nope, posthtml-hint (just a wrapper around HTMLHint), I'm playing around migrating/building upon htmllint on top of posthtml, currently htmllint is/was a student's project, if I remember that right, so long-term usage and future development is highly uncertain. A good linter is one of posthtml's greater lacks atm
Jitendra Vyas
@jitendravyas
Is there any other tool?
What i actually want is that if inhtml a developer use a css class and if that same classes name have been used somewhere else already in the project, it should give error message to developer
Michael Ciniawsky
@michael-ciniawsky
posthtml-classes as starting point, to hack your own solution maybe
Jitendra Vyas
@jitendravyas
Jitendra Vyas
@jitendravyas
@jescalan it seems Reshape has better options for templating.
by the way is it possible to use PostHTML and Reshape both together?
Jeff Escalante
@jescalan
I'm also definitely interested in html linting, would be happy to help with a project like this
it's on my list!
it would need some good text editor plugins as well to be really solid
what do you mean by use them together?
the apis for the two aren't compatible, if this is what you're asking, so you cant for example use a posthtml plugin with reshape or the other way around