remy / inliner

Node utility to inline images, CSS and JavaScript for a web page - useful for mobile sites
MIT License
1.1k stars 165 forks source link

Not inlining <script data-main> #204

Open tarekeldeeb opened 5 years ago

tarekeldeeb commented 5 years ago

HTML having

<script data-main="app.js" src="require.js"></script>

will only get require.js inlined, app.js will be ignored ..

The output looks as:

<script data-main="app.js"> ... __COMPRESSED_CONTENT_OF_REQUIRE.JS__..</script>

Apparently, the inlined page does not display correctly without app.js.

tarekeldeeb commented 5 years ago

Trying to find a workaround by splitting that line, first sourcing require.js, then

<script>require(["app.js"]);</script>

Unfortunately, the above line does not get inlined as well.

remy commented 5 years ago

Oh, no, inliner doesn't parse the contents of scripts (and the modules that are loaded) so it won't inline from a require nor data-main - it'll need to be a src attrib.

I wonder if you could do something like:

<script type="noop" src="app.js"></script>

but then I've got a feeling that inliner also ignored non-js script tags…

On Tue, 5 Nov 2019 at 10:06, Tarek Eldeeb notifications@github.com wrote:

Trying to find a workaround by splitting that line, first sourcing require.js, then

Unfortunately, the above line does not get inlined as well.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/remy/inliner/issues/204?email_source=notifications&email_token=AAADLBAZOL7MEOXZKVKNIYDQSFAT5A5CNFSM4JJAIXD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDCJLWI#issuecomment-549754329, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAADLBEE6TPOZ3DKLTHLWWLQSFAT5ANCNFSM4JJAIXDQ .