nambo / gulp-js-import Goto Github PK
View Code? Open in Web Editor NEWgulp-js-import
License: MIT License
gulp-js-import
License: MIT License
Hi,
I've set my compile task like this:
return gulp.src(`src/js/script.js`)
.pipe(sourcemaps.init())
.pipe(js_import())
.on('error', error)
.pipe(babel({presets: ['es2015']}))
.on('error', error)
.pipe(uglify())
.on('error', error)
.pipe(rename('script.min.js'))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('dist'))
.pipe(livereload());
But when an error occurs (for instance on babel), the error line is related to script.js after importing the js dependencies.
How can I get this to work? I can't debug my app blindly.
Thanks,
Quentin
gulp-util
is deprecated, you should remove this dependency.
Read here for more info: https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
Hi,
thanks for this module, I included it in one second :)
I would just ask you if there is or it is planned the possibility to import many modules using a wildcard:
@import './widgets/*.js'
I have this in my Gulp file:
gulp.src( scripts )
.pipe( jsImport( { hideConsole: true } ) )
.pipe( rename( { suffix: '.min' } ) )
.pipe( babel({
presets: ['es2015-script'],
parserOpts: { sourceType: 'script' }
}).on('error', function(err) { console.log(err) }) )
.pipe( uglify() )
.pipe( gulp.dest( paths.js ) );
2 files:
file1.js:
@import ./base/jsfile1.js
file2.js:
@import ./base/jsfile1.js
And in the minified version of file1.js I get jsfile1.js and in file2.js, I just get:
;
instead of the imported file.
I really love this package. It's ultra simple and does exactly what I wanted to do.
I was first going in trouble with browserify, which does complex things for simple purposes.
And with this package, I can now keep my global variables and split all my js in as many files I want.
Now I just want to disable the two console.logs, because I want to keep my console clear.
Is there an option for that?
Hy,
Is there a way commenting without consider an actual import the folowing: //@import '.../myscrpt.js' ?
Btw, helpful plugin. Ty
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.