Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass options.from to plugins #303

Closed
giuseppeg opened this issue Aug 8, 2020 · 6 comments
Closed

Pass options.from to plugins #303

giuseppeg opened this issue Aug 8, 2020 · 6 comments
Labels

Comments

@giuseppeg
Copy link
Contributor

Hi folks, is there a way to get the options.from passed to plugins when using posthtml-cli?

@Scrum
Copy link
Member

Scrum commented Aug 10, 2020

@giuseppeg Hi, if you are using CLI then you just need to indicate posthtml inputFolder/**/*.html or you can also specify the root directory posthtml **/*.html -r inputFolder -o outputFolder, if using posthtml.config.js then you can independently adjust the root directory for input files.

const path = require('path');
const inputRoot = path.resolve(__dirname, 'src');

module.exports = {
  input: `${inputRoot}/**/*.html`
}

@Scrum Scrum added the question label Aug 13, 2020
@Scrum
Copy link
Member

Scrum commented Aug 13, 2020

You can reopen the issue if I can help you with something in this matter.

@Scrum Scrum closed this as completed Aug 13, 2020
@giuseppeg
Copy link
Contributor Author

@Scrum I am using posthtml-cli and setting the -r option but the plugin is not receiving the filename that is being processed:

.then(html => Promise.resolve(posthtml(plugins).process(html, config.options)))

Every time we visit a file we should pass options.from I think

.then(html => Promise.resolve(posthtml(plugins).process(html, { ...config.options, from: file } )))

@Scrum Scrum reopened this Aug 17, 2020
@Scrum
Copy link
Member

Scrum commented Aug 17, 2020

I am using posthtml-cli and setting the -r option but the plugin is not receiving the filename that is being processed:

@giuseppeg Thanks for the find, it looks like a bug

@Scrum Scrum added bug and removed question labels Aug 17, 2020
@Scrum Scrum closed this as completed in 5ec996f Aug 17, 2020
@giuseppeg
Copy link
Contributor Author

@Scrum thanks! It seems that you released a fix, how can I access from in the plugin now?

@Scrum
Copy link
Member

Scrum commented Aug 18, 2020

@Scrum thanks! It seems that you released a fix, how can I access from in the plugin now?

ohh, I completely forgot about this option. i will add to release #314

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants