Parcel: Multiple html entrys not shared css assets

Created on 26 May 2018  ยท  7Comments  ยท  Source: parcel-bundler/parcel

โ” Question

1119 multiple entry support, shared javascript working, but external css not shared only index.html shared css

๐Ÿ”ฆ Context

๐Ÿ’ป Code Sample

https://github.com/c0b41/parcel-html-boilerplate

๐ŸŒ Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.8.1
| Node | 8.10.0
| npm/Yarn | 1.5.1
| Operating System | Windows 10 Home

Question

Most helpful comment

Have anyone solved this problem ?, I have the same issue and I haven't been able to find a solution. Parcel will include the CSS file in the first file after the parcel command and won't do it for the subsequent files in the list so in:

  "scripts": {
    "build": "parcel home.html index.html"
  }

Parcel will only add the .css file to home.html but not to index.html. Can't believe the parcel team hasn't been able to come with a solution for such an important issue. Any help will be really appreciated.

All 7 comments

Please fill in the issue template.

@DeMoorJasper updated.

I have the same problem? Is there any progress on this issue?

when I bundle multiple entry points, I get my SCSS converted to CSS and bundled with bootstrap.css as expected and jquery.js/bootstrap.js/custom.js bundled on the first html file in alphabetical order, and the rest only HTML & JavaScript, it is not adding the <link href="{name}{hash}.css"> to subsequent pages.
I have tried these...
parcel *.html and parcel index.html about.html contact.html documentation.html repository.html

fyi: each page (index.html, about.html, etc) links to index.js like so...
<script src="./index.js"></script>

and the contents of index.js are...

import './vendor/bootstrap/css/bootstrap.min.css'
import './vendor/fontawesome-free/css/all.min.css'
import './scss/custom.scss'
import './vendor/jquery/jquery.min.js'
import './vendor/bootstrap/js/bootstrap.bundle.min.js'
import './js/custom.js'

So to reiterate, the first entry point (in alphabetical order, in my case it chooses about.html) gets links to both the bundled css & javascript, but the rest of the pages only get a link to the bundled javascript.

Here are the resulting about.html and index.html after having executed parcel *.html
notice how on line 16 of about.html a link is inserted into the <head> referring to the bundled css. Where as in subsequent html files, such as index.html there is not.

Have anyone solved this problem ?, I have the same issue and I haven't been able to find a solution. Parcel will include the CSS file in the first file after the parcel command and won't do it for the subsequent files in the list so in:

  "scripts": {
    "build": "parcel home.html index.html"
  }

Parcel will only add the .css file to home.html but not to index.html. Can't believe the parcel team hasn't been able to come with a solution for such an important issue. Any help will be really appreciated.

Closing as duplicate of #2340

Facing the same issue css only shows on the first index.html file and not on the following html files. Is there a solution to this?

Was this page helpful?
0 / 5 - 0 ratings