Comments (3)
@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.
@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.
@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)
- Templating - Img tag requires src attribute to be first HOT 2
- Supporting templates overrides the filetype array HOT 1
- Can cause unexpected behavior when uglify is run before assetpaths
- Match elements spanning multiple lines
- @font-face
- Add support for paths in JSON files HOT 1
- Handle live internet image sources
- Support streams
- customAttributes: srcset path replacement works on first entry only
- Doesn't do well with minified css, especially cssnano
- templates set false but replace with url,but I don't want to be replaced.
- href's to downloadable files in templates not being replaced
- src attributes are being replaced without img or script tag being present HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gulp-assetpaths.