Parcel: newly generated css is not injected into html

Created on 20 Apr 2018  路  2Comments  路  Source: parcel-bundler/parcel

Choose one: is this a 馃悰 bug report or 馃檵 feature request?
I think it's a bug

1) If a HTML file links to index.js and index.js import index.css, parcel will insert a link tag in the generated HTML. Everything works fine. 馃憤

2) However, if index.js initially doesn't import index.css and instead the css file is created and imported in index.js after running Parcel, a css bundle is correctly generated but not inserted in the generated HTML files. 馃槩

馃帥 Configuration (.babelrc, package.json, cli command)

no babel configuration.

馃 Expected Behavior

a new link tag is inserted into the generated HTML and points to the newly generated CSS bundle

馃槸 Current Behavior

The generated HTML file does not link to the generated CSS bundle

馃拋 Possible Solution

Not sure. Maybe detecting cases like this and re-generating the HTML accordingly? I see some relevant logic in HTMLPackage.js but it's not rerun in this case.

馃敠 Context

I sometimes start a project without CSS and only create them and import them after I started running Parcel. Currently I have to restart Parcel after doing that to make it work.

馃捇 Code Sample

馃實 Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.7.1
| Node | 8.9.1
| npm/Yarn | 1.5.1
| Operating System | MacOS

Bug

Most helpful comment

Just got the same problem.
Oh change parcel build index.js to parcel build index.html works.

All 2 comments

Just got the same problem.
Oh change parcel build index.js to parcel build index.html works.

Yup, I have the same issue. Wasted about 20 minutes trying to figure out what I was doing wrong until I realized I needed to restart.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

medhatdawoud picture medhatdawoud  路  3Comments

Niggler picture Niggler  路  3Comments

will-stone picture will-stone  路  3Comments

dotdash picture dotdash  路  3Comments

466023746 picture 466023746  路  3Comments