sindresorhus / multiline

Multiline strings in JavaScript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to go without `requirejs`

mightyiam opened this issue · comments

Hi! Thank you for useful software.

I'm using it like this, in an essentially adapted way, because I didn't want to add requirejs as a dependency.

I'd love to know how a more experienced JavaScript developer would have done it.

Not sure why you think requirejs is required, seeing as there is no mention of it at all, but it's definitely not required.

You just include browser.js in your HTML and use it like shown in the readme:

var str = multiline(function(){/*
<!doctype html>
<html>
    <body>
        <h1>❤ unicorns</h1>
    </body>
</html>
*/});

Thank you, @sindresorhus. I understand now. The reason that I thought that require.js is a requirement is:

  1. I expected the browser version to be included in the nodejs package.
  2. I installed the nodejs package using npm.
  3. I only saw the index.js file.

Lesson learned.

Could you include browser.js in the nodejs package so that I could use it as a dependency, please?

Could you include browser.js in the nodejs package so that I could use it as a dependency, please?

Done. I just assumed people use browserify with npm on the front-end.