Comments (6)
gulp-include seems to have a problem with the line endings. I just "included" a file with CR and LF for line endings, in the final file there are two lines per line.
So in Notepad++ I replaced \r\n
(CRLF) with \r
(CR) and recompiled. Everything's fine now. Funny thing: when I just use LFs, I also get two lines.
So I suppose your first file uses CRLF or maybe just LF, the others use CRs.
from gulp-include.
The problem seems to be with the DIRECTIVE_REGEX.
There are no problems if you use it like this:
(function() {
//= include file.js
//= include file2.js
})();
But when you start adding newlines. It will start adding two newlines after each line in your include file.
(function() {
//= include file.js
//= include file2.js
})();
from gulp-include.
I think the trouble on line 79, where:
whitespace = whitespace[0].replace("\n", "");
This clears only first \n
from whitespace matches, when for first include it equals to '\n\n'
, so after it expression whitespace
is truthy (when we except false).
I've made pull reques.
from gulp-include.
This is fixed in the new version. Closing!
from gulp-include.
@wiledal Getting double lines on v2.0.2 (Windows) on any require/include command that is preceded by empty lines.
ex: The footer here gets double lines.
//=include inc/page-header.inc
test page
//=include inc/page-footer.inc
Adding something right before the include fixes the problem:
//=include inc/page-header.inc
test page
something
//=include inc/page-footer.inc
from gulp-include.
I'm also getting this issue with version 2.0.2 on Windows. Solved for now by removing blank lines in front of //=include
statements. But permanent solution would be great!
from gulp-include.
Related Issues (20)
- Ability to control syntax HOT 2
- Error preventing run HOT 2
- Pre and post processing
- Variables not scoped properly HOT 3
- gulp-include and eslint and proper line numbers? HOT 1
- processInclude processes output file indefinitely (or until the stack explodes) HOT 1
- Require Behaviour HOT 2
- Compile before include
- Gulp include breaks the code on windows system HOT 1
- Add "include-if-exists" functionality
- how do I to insert file conten inside quotation marks? HOT 2
- Replace deprecated dependency gulp-util HOT 1
- Independent require in several files HOT 5
- Possibly remove/lock event-stream HOT 1
- gulp-util removal request HOT 2
- Anyone know of a good alternative? HOT 13
- When multiple files are matched, it includes both of them. HOT 7
- TypeError: resultMap.eachMapping is not a function HOT 5
- Question about src/js/main.js
- Any way to use sourcemaps and minification of files?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gulp-include.