cgross / gulp-dom-src Goto Github PK
View Code? Open in Web Editor NEWCreate a gulp stream from script, link, or any set of tags in an HTML file.
License: MIT License
Create a gulp stream from script, link, or any set of tags in an HTML file.
License: MIT License
I'm getting the following error:
[12:57:02] Error: Missing positive glob
Guess there was some BC on gulp or a dependency causing this? Thank you.
Here's my task:
gulp.task('js', function() {
return domsrc({file:'source/wp-content/themes/'+project.theme+'/footer.php',selector:'script',attribute:'src'})
.pipe(concat('app.min.js'))
.pipe(uglify())
.pipe(gulp.dest('runtime/wp-content/themes/'+project.theme+'/'));
});
project.theme = 'leviathan' and resolves to a real path
The second half from your example works (removing the scripts and injecting the reference to the minified script) but the minified script is never created in the /runtime/ directory.
This is the JS in my footer.php:
<script src="/wp-content/themes/leviathan/assets/js/libraries/jquery-1.10.1.min.js"></script>
<script src="/wp-content/themes/leviathan/assets/js/libraries/gumby/ui/gumby.checkbox.js"></script>
Is there any way for gulp-dom-src to be writeable? I am generating html which I want to pipe into gulp-dom-src to scan for script tags.
Right now I am doing
gulp.task('processScripts', function(cb) {
var generateHtml = gulp.src(pathToTemplates)
.pipe(evalTemplates())
.pipe(gulp.dest(destDir));
generateHtml.on('end', function() {
var processScripts = gulpDomSrc({
file: destDir + 'index.html',
selector: 'script'
attribute: 'src'
})
.pipe(processJsFiles())
.pipe(gulp.dest(...);
processScripts.on('end', cb);
});
});
I use events to order things properly and write/read disk an extra time.
I wish I could do
gulp.task('processScripts', function() {
return gulp.src(pathToTemplates)
.pipe(evalTemplates())
.pipe(gulpDomSrc.writeable({ // <-- this would be new
selector: 'script'
attribute: 'src'
})
.pipe(processJsFiles())
.pipe(gulp.dest(...);
});
Would you be open to a PR that implemented something like the latter example?
With newest update of Vinyl-fs, gulp-dom-src isn't returning a properly formatted vinyl type that vinyl-fs can consume.
domSrc({
file: files.app.indexHtml,
selector: 'script',
attribute: 'src'
})
.pipe(...)
.pipe(gulp.dest(...));
Error: Received a non-Vinyl object in dest()
$ gulp -v
[12:06:08] CLI version 2.0.0
[12:06:08] Local version 4.0.0
Gulp ^4.0.0 using Vinyl-FS^3.0.0
if my filepath includes a queryParam how can I ignore the queryParams?
Eg. when I want to fetch the file it should be the file styles/main.less
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.