Giter Site home page Giter Site logo

Comments (8)

trisys3 avatar trisys3 commented on May 27, 2024 1

I posted this in the gitter, but no one responded yet: How would I set the directive(s) in the webpack loader?

from posthtml.

Scrum avatar Scrum commented on May 27, 2024

@trisys3 Hi, thanks for the feedback and I'm sorry that I didn't notice your message in gitter. I will try to sort out your question as soon as possible.

With a cursory reading of your problem, as far as I was able to understand you are experiencing problems using directives from PHP. They should work because tests are passed on them.

https://github.com/posthtml/posthtml-parser/blob/241a34377c7e6f43e78a0ec39d31c3279c737966/test/test.js#L126-L169

Perhaps you did not explicitly specify the type of directive you are using in the options

import posthtml from 'posthtml'

const php = `
  <component>
    <title><?php echo $title; ?></title>
    <text><?php echo $article; ?></text>
  </component>
`

const result = posthtml()
  .use(require('posthtml-custom-elements')())
  .process(html, {
    directives: [
      { name: '?php', start: '<', end: '>' }
    ]
  })
  .html

console.log(result)

from posthtml.

trisys3 avatar trisys3 commented on May 27, 2024

That's fine, you were a lot faster than most issue answerers I've worked with. I haven't used gitter actually, is that the way you like to communicate on this repo?

I don't see directives as an option for posthtml.process. According to the API page for PostHTML, there are 4 options: sync, parser, render & skipParse. What does directives do, and where is it documented?

from posthtml.

trisys3 avatar trisys3 commented on May 27, 2024

I found the docs for directives, under the repo for parser. I didn't see any place that mentioned these options are used in the process function.

The directives option is a little confusing, too. Does this actually make the parser ignore the directive? What does the parser do otherwise, with directives that aren't ignored?

If this is what I'm meant to do, then I guess I'll close the issue, though I still think the docs are a bit confusing.

from posthtml.

Scrum avatar Scrum commented on May 27, 2024

I found the docs for directives, under the repo for parser. I didn't see any place that mentioned these options are used in the process function.

https://posthtml.org/#/usage?id=api / https://github.com/posthtml/posthtml#api
under the description about async

The directives option is a little confusing, too. Does this actually make the parser ignore the directive?

yes

What does the parser do otherwise, with directives that aren't ignored?

Attempts to parse them, the parser should not know about third-party directives unless explicitly specified in the options

from posthtml.

Scrum avatar Scrum commented on May 27, 2024

I posted this in the gitter, but no one responded yet:

Hi, github is now the preferred and faster way to communicate.

How would I set the directive(s) in the webpack loader?

Apparently this functionality is not implemented in posthtml-loader

from posthtml.

trisys3 avatar trisys3 commented on May 27, 2024

That was fast, less than 2 weeks ago you recommended using gitter, in this same issue no less.

I noticed you opened another issue on posthtml-loader, thanks. I'm sure you already saw this, but I added a comment with more details about what I'm trying to do.

from posthtml.

Scrum avatar Scrum commented on May 27, 2024

That was fast, less than 2 weeks ago you recommended using gitter, in this same issue no less.

Yes, I try to quickly adapt to the situation and I see that I won't be able to pull another messenger and it's not effective for me. So I came to the conclusion that github is a convenient way for me to understand and solve the problem and everything in one place)

I noticed you opened another issue on posthtml-loader, thanks. I'm sure you already saw this, but I added a comment with more details about what I'm trying to do.

Thank you, it was important for the prompt solution of the problem

from posthtml.

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.