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

gulp dependency breaks gulp in the middle
No CSS with Gulp
gulp move files to parent directory
How to get gulp-jshint to ignore folders
Inserting specific file at index of a stream
How to pass array from gulp to other js files?
BrowserSync + Gulp with Vagrant not refreshing
gulp-tslint return undefined when required
Gulp watch only runs once
Gulp watch not working with imported files but works with main file
Gulp watch for css doesn't work
Using gulp for compiling of changed files only
How to run gulp task in visual studio code?
BrowserSync with custom URL
Multi-tenancy and Semantic UI
Display total number of errors with Gulp Jshint

Categories

HOME
leaflet
ns2
formatting
x86-64
ubuntu-14.04
bitbucket
sms
snmp
psexec
webpack-dev-server
box-api
segmentation-fault
olap
digital
ndepend
vichuploaderbundle
xmlhttprequest
opendaylight
brightway
pylint
internet-explorer-7
printf
audio-streaming
connection-pooling
oracle10g
orgchart
bytebuffer
pypy
ipython-parallel
semantic-ui-react
wordpress-rest-api
ibm-bpm
unity3d-5
device-driver
stochastic-process
var
ngrok
mediastream
icu
file-descriptor
superclass
encoder
nao-robot
import.io
seyren
sharing
fileopendialog
distcc
access-violation
jira-agile
require-handlebars
normalisation
django-celery
pebble-js
datamodel
markerspiderfier
newlib
recode
serial-communication
jts
random-sample
edgar
biginsights
log4cxx
tidesdk
veeam
pysvn
method-overloading
os.walk
switchpreference
hotlinking
yandex-api
winrun4j
code-smell
jsmpp
sigma-grid-control
pechkin
nsnumber
leap-year
asp.net-4.0
screensharing
databus
dancer
motorola-droid
openwrap
backlight
cryptolicensing
subdirectories
system-analysis
djangoappengine

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