Giter Site home page Giter Site logo

Comments (3)

qwales1 avatar qwales1 commented on July 19, 2024 1

@ccbayer realized that it couldn't change that much because not everything it replaces is an attribute, for example css files, but version 0.3.0 allows you to pass an array of customAttributes and it will replace them. Let me know if you run into any issues with it.

from gulp-assetpaths.

qwales1 avatar qwales1 commented on July 19, 2024

@ccbayer yeah I think that would be a better approach overall. I don't use this plugin much myself anymore, but I definitely like the idea of making it more explicit what should get replaced. gulp-regex-replace looks interesting. It has the option to pass in the regular expression you want to match and lets you use a capture group to only replace that portion which would be perfect for the data attribute example. This plugin may be able to use that under the hood. Maybe could look something like ...

var config = {
   oldDomain: oldDomain,
   newDomain: newDomain,
   docRoot: 'public_html',
   //list of attrs you want to change path of
   replace: ['data-lazyload', 'src', 'href' ...etc],
   //don't change path if the file is in these types
   excludeFiletypes: ['css', ...etc],
   //maybe add ability to specify template delimiters
   templateDelimiters: [
     { open: '{{' , close: '}}'},
     { open: '<?php', close: '?>'},
     { open: '<%', close: '%>}'}
   ]
}

gulp.src('index.html')
  .pipe(assetpaths(config))
  .pipe(gulp.dest('./dist'))

from gulp-assetpaths.

ccbayer avatar ccbayer commented on July 19, 2024

@qwales1 thanks Chris! i ended up using a variation of that (regex on a plugin called gulp-replace - it's more or less the same as gulp-regex-replace but probably less robust). it does the job "for now" but is a bit brittle in its current form...alas. i'll take a look at using the customAttributes option at a later date.

from gulp-assetpaths.

Related Issues (14)

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.