gulp


What does “!” mean in file paths?


I am reading over someone's gulpfile.js that I found, and came across an interesting character that I've not seen in file paths before; the ! symbol. I tried to do some searches for this but yielded nothing.
gulp.task("min:js", function () {
gulp.src([paths.js, "!" + paths.minJs], { base: "." })
.pipe(concat(paths.concatJsDest))
.pipe(uglify())
.pipe(gulp.dest("."));
});
Does the ! have some particular meaning, here?
I'm not an expert on Gulp, but a quick search shows that it tells gulp to ignore a given path.
Prepending a path with an exclamation mark tells Gulp to exclude that directory.
So, in your example, paths.minJs should be excluded from the task Gulp is performing.
Actually it is used to negate a pattern, based on the answer to another question. That is, it is used to select what does not match the following pattern. As a consequence, it ignores the path in the pattern.
Additionnaly to my above comment that I report here:
Note that if your task has to compile js into minified js, you would rather use 2 differents folders. As an example, a folder /source/js/ whose files are compiled in min.js into /dist/js/ ( or /public/js/ or anything you want ).
This a piece of code I often use to concatenate and uglify my Js files in most of my projects:
// My task called jsmin depend on another task, assume it is called clean but could be whatever
// That means that until the clean task is not completed, the jsmin task will not be executed.
gulp.task( 'jsmin', ['clean'], function() {
// First I clean the destination folder
del([ 'public/js/*' ]);
// Then I compile all the Js contained in source/js/ into min.js into public/js/
// In my example I concatenate all the Js together then I minimize them.
return gulp.src( 'source/js/*.js' )
.pipe(concat( "js.min.js" ))
.pipe(uglify())
.pipe(gulp.dest('public/js/'));
});
Hope that helps you.

Related Links

when I run (npm install gulp-msbuild) inside the Package Manager Console (VS2015), it throws warning
Gulp-kss issues
Browserify - accurate build log in terminal with o: --colors, silimar to webpack
Minimist not finding arguments
Gulp.js. Same task on watch, with different parallel tasks
Split css for different devices
Gulpfile not working when module.exports references a Gulp task not a function?
Use gulp to process bowser files
Getting an error when trying to serve the app using browser-sync
Can't Sprite using gulp.spritesmith
How can I make build variables available to all JS files in gulp?
Gulp not installed globally?
gulp-useref deep folders error
use gulp+browserify+reactify, can't emit exit when got a ReactifyError
gulp-browserstack and gulp-cucumber don't seem to play nicely together
Gulp - Babel - EcmaScript-6 - Redux / Unhandled stream error in pipe

Categories

HOME
http
indexing
azure-documentdb
marie
packet
python-requests
phantomjs
popover
conceptual
x86-64
ms-application-insights
artifactory
mailchimp
uml-designer
foreach
flowtype
hibernate-mapping
markdown
samsung-gear-s2
token
point-of-sale
comma
fastreport
android-notifications
jinja2
brightway
pylint
fastboot
smart-device
windows-10-mobile
javapns
selenium3
lines
tikz
flickr
wunderground
cocoa-scripting
kepserverex
mongoid5
autodesk-data-management
definition
colorbox
qt-quick
apiman
codepen
html-entities
amazon-fire-tv
ocpjp
azure-data-catalog
reqif
rivets.js
aws-rds
r-commander
android-vectordrawable
distcc
git-push
x12
django-celery
3d-rendering
periodic-processing
wizard
containstable
transport
photogrammetry
jeet-grid
douglas-peucker
backtrace
xcode5
uiblureffect
system.net
behance-api
yandex-api
autofilter
zend-db-table
violation
removeall
cryptarithmetic-puzzle
event-propagation
flatten
django-1.4
inserthtml
peoplepicker
opendir
overlays
jexcelapi
method-call
iphone-maps
silverlight-2.0
opengl-to-opengles
j++

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App