posthtml / posthtml-extend

Template extending (Jade-like)
MIT License
47 stars 9 forks source link

Useful Documentation #19

Closed kwhat closed 5 years ago

kwhat commented 5 years ago

Hi,

Can we get some useful documentation about how to use this? I see the following, but I have no idea what to do with it... Boom some loose JS woot! This must be the answer to every problem I have ever had! Maybe I need to put this in a JS or HTML input file? Oh but I tried that and it does nothing. posthtml -o output.html -i input.js returns with no errors and produces nothing! 8 hours that I am never getting back.

var posthtml = require('posthtml');
var html = `<extends src="base.html">
      <block name="title">How to use posthtml-extend</block>
      <block name="content">Read the documentation</block>
  </extends>`;

posthtml([require('posthtml-extend')({
    encoding: 'utf8', // Parent template encoding (default: 'utf8')
    root: './' // Path to parent template directory (default: './')
})]).process(html).then(function (result) {
    console.log(result.html);
});
Scrum commented 5 years ago

@kwhat Hi, maybe this example will help you figure it out. Let me know if something goes wrong)

kwhat commented 5 years ago

Ok, thanks for the link. I have managed to get it to run in a standalone state, however, trying to integrate with parceljs is unbelievably autistic. Zero config, lmao. Time to try one of the other 3000 build utilities for node.

Scrum commented 5 years ago

@kwhat good luck ) close this issue ?

kwhat commented 5 years ago

I wouldn't call it good luck... honestly, using webpack and npm has been one of the most miserable experiences of my professional career. Who would have thought that creating a simple HTML file with an include(myVariable) would be so incredibly hard. I honestly never want to see Javascript again in my life.