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

Replacing Existing Attribute #11

Open
yehiasalam opened this issue Apr 15, 2016 · 0 comments
Open

Replacing Existing Attribute #11

yehiasalam opened this issue Apr 15, 2016 · 0 comments

Comments

@yehiasalam
Copy link

Hi,

How can append to the existing attribute value, for example i want to change a part of the attribute based on the current value, how can I do that:

    gulp.src("./config.xml")
      .pipe(xeditor([
        { path: "//*[local-name() = 'name']", text: p.name },
        { path: "//*[local-name() = 'widget']", attr: { 'id': p.id, 'version': p.version } },
        { path: "//*[local-name() = 'icon']", attr: { 'src': str.replace(/([\w.-]+)(\/[\w.-]+)$/gm, p.resources +  "$2") } }

      ]))
      .pipe(gulp.dest("."));

str here would be ideally the existing attribute value, is this supported?

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

No branches or pull requests

1 participant