Git Product home page Git Product logo

Comments (6)

mehtmehtsen avatar mehtmehtsen commented on July 1, 2024

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.

rikjurjens avatar rikjurjens commented on July 1, 2024

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.

zefirka avatar zefirka commented on July 1, 2024

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.

wiledal avatar wiledal commented on July 1, 2024

This is fixed in the new version. Closing!

from gulp-include.

Skosiris avatar Skosiris commented on July 1, 2024

@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.

jelmerdemaat avatar jelmerdemaat commented on July 1, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.