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

My default gulp task is not executing other tasks
Gulp Browserify SourceMaps
What is the purpose(s) of JavaScript build tools
gulp-jshint utters errors when using browserify
Gulp “watch” is not running the sub task “sass” on file change
Proxy URL not working with BrowserSync Gulp task
the task can't be called by watch module.
I can't get the data-uri() function to work on gulp.js to base64 an image on mac
How to inject bower dependencies in karma.conf.js file with gulp?
Getting Libsass Gulp Susy to work together
Gulp compass without config.rb
gulp-webserver: Default to index.html if available, else show directories
gulp-uglify notify on failing build
Declaring optional dependencies
gulp html minification error
Can an IIFE be added to a browserify bundle?

Categories

HOME
spring-boot
postgresql
model-view-controller
alasql
virtual-machine
cors
ibm
arcgis
azure-resource-manager
query-string
xss
opengl-es
hibernate-mapping
install
promotions
openbsd
ndepend
velocity
element
derby
background-image
vivado-hls
ofbiz
xforms
turn.js
ajaxcontroltoolkit
beaker-notebook
tcpdf
google-drive-android-api
prepros
scrapy-spider
sha
sasl
tftp
typeorm
request-uri
selenium3
mplab
ng2-bootstrap
zimbra
wunderground
dom4j
motion
nscollectionview
gem-fury
aspose.pdf
ng-lightning
wicket-tester
aura-framework
grails-2.0
activeandroid
yank
react.rb
enet
nls
breadcrumbs
sharing
fileopendialog
easy-thumbnails
turbolinks
weblogic-maven-plugin
firefox-os
oryx
askbot
matlab-engine
event-tracking
gulp-cdnizer
transport
syncano
firewire
eula
jeet-grid
copy-on-write
ultraedit
nfa
chrome-mobile
famous-engine
autofilter
misfire-instruction
8-puzzle
violation
bho
cloudmade
django-tinymce
feincms
big-endian
webpage-screenshot
xcode4.6.3
ios6-maps
socketasynceventargs
wxperl
towerjs
vectorwise
windows-xp-embedded
pitch-shifting
large-data-volumes
atmega16
qlibrary
jgrowl

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