Git Product home page Git Product logo

gulp-html-partial's People

Contributors

xkxd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gulp-html-partial's Issues

Deletes space after second span

Expected:
<p>Lorem ipsum dolor sit amet <span class="underline">consectetur</span> et <span class="underline">dipiscing</span> elit.</p>

Output:
<p>Lorem ipsum dolor sit amet <span class="underline">consectetur</span> et <span class="underline">dipiscing</span>elit.</p>

Any chance to fix this?

Partial without opening tag in it causes crash

I've defined partial _foot.html that contains only </body></html> in it. If you try to build you project with such partial, you'll get a crash with the following trace:

/Users/rpeshkov/Developer/markup/rpeshkov.net/node_modules/html/lib/html.js:466
            var tag_extracted_from_last_output = multi_parser.output[multi_parser.output.length -1].match(/<\s*(\w+)/);
                                                                                                    ^

TypeError: Cannot read property 'match' of undefined
    at Object.style_html [as prettyPrint] (/Users/rpeshkov/Developer/markup/rpeshkov.net/node_modules/html/lib/html.js:466:101)
    at injectHTML (/Users/rpeshkov/Developer/markup/rpeshkov.net/node_modules/gulp-html-partial/gulp-html-partial.js:132:36)
    at getPartial (/Users/rpeshkov/Developer/markup/rpeshkov.net/node_modules/gulp-html-partial/gulp-html-partial.js:89:20)
    at tags.map (/Users/rpeshkov/Developer/markup/rpeshkov.net/node_modules/gulp-html-partial/gulp-html-partial.js:117:44)

However, if you slightly change this partial to something like <b></b></body></html> then it works fine.

Question: active nav?

Is there a way to implement variables that enable me to create an active nav on each page?

useref not finding flag after html compiled

Hi!

This isn't really an issue needing resolve, however I thought this would be super useful for others.

Love this little Gulp plugin - great for HTML management when the introduction of something like Mustache or Handlebars isn't an option.

I came across an issue when using this plugin and useref. All it took to fix it was to clean up the line endings after you've run it. Suspect this is likely to be more of a problem for those with a windows / sublime combo.

However, install gulp-line-ending-corrector, require and use it in your task like this:

gulp.task('html-partials', function () {
	return gulp.src('app/html/*.html')
	.pipe(htmlPartial({
		basePath: 'app/html/'
	}))
	.pipe(lec({verbose:true, eolc: 'LF', encoding:'utf8'})) // clean up line endings for useref to find flags
	.pipe(gulp.dest('dist'))
	.pipe(livereload());
});

Bosh! useref works just fine and dandy and able to find your flags. Hope it helps others along the way!

Only replaces first instance of variable

Hi

Moving over from grunt to gulp and replacing grunt-bake with this task

i have the following partial

<partial src="accordion.html" identifier="first"></partial>

accordion.html is

<h2 class="c-accordion__heading heading js-accordion-heading" id="@@identifier-accordion-header-1" role="tab" aria-controls="@@identifier-accordion-panel-1" aria-selected="false" aria-expanded="false">Accordion header 1</h2>

output

<h2 class=" js-accordion-heading" id="first-accordion-header-1" role="tab" aria-controls="@@identifier-accordion-panel-1" aria-selected="false" aria-expanded="false">Accordion header 1</h2>

Does it not work on multiple instances of a variable?

SyntaxError

Hi.
At first thanks for your work. Gulp-html-partial is what I looked for.

When I tried to check how the plugin works (https://runkit.com/npm/gulp-html-partial), there error occurred โ€“ "SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode". I hope you'll have time to check it.

Get nested partial by variable path

Would it be possible to get a partial via a variable like so?

Main file -

<body>
    <partial src="child.html" content-partial="content.html" ></partial>
</body>

child.html

<div class="child-component">
    <partial src="@@content-partial" ><partial>
</div>

content.html

<p>Lorem ipsum...<p>
<p>Dolor sit amet...<p>

This functionality would be really helpful when making reusable templates with nested partials!

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.