-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🙋 Static Site Folder Structure? #303
Comments
duplicate of #233 |
I've been looking through that issue, and I don't think it's a duplicate. That issue is asking for an option to specify a sub-folder for the output assets. Whereas I am proposing a change in architecture of how parcel handles its paths & static folders to support a simple static site structure. This allows users to build a site in a single root folder (not possible right now with parcel) or in a sub folder like IMHO there should just be a flag
This way, you can use the following commands for your entire static site, deployed to
And your project folder would simply be structured like so: app/
index.html <-- written by user, points to src="index.js"
index.js <-- generated by parcel
src/
index.js <-- source code During development, you just open To support the same directory (which is even more useful for parcel index.js --dir . --out-file bundle.js Your entire static site & project folder would look like this: index.js <-- source code
index.html <-- source HTML
bundle.js <-- generated by parcel Forgive me if I'm misunderstanding some core concept of parcel... I am struggling to understand how you are using it right now to build static sites with clean URLs. |
Sorry for misunderstanding, i'll reopen the issue |
I think there is an issue with parcel index.js --out-dir app/ I would expect that opening Using an HTML entry point is a little better, as I can actually run my code: src/index.html --out-dir app/ But then all the URLs are relative to I would have expected this to fix the latter issue, but it runs into an error I mentioned in my OP: src/index.html --out-dir app/ --public-url ./ |
Yeah, i marked it as a bug/feature, if u want u can have a look at it, otherwise somebody else probably will later on |
Has anyone managed to find a workaround for this? |
Going to close this. This is a very old issue and I think Parcel 2 offers the tools needed to implement what is being requested here. |
🙋
I'm looking to create a project with a folder structure similar to this:
Where the code is in one folder (
src
), and the static files are in another (app
). The same static folder is then used during dev and production.The main goal of this is a clean repo without unnecessarily duplicated folders/files and clean relative URLs to PNG/JPG/etc assets (not all of which can be imported). The structure is ideal for
gh-pages
demos or basically any small static site.For an example of how an entire repo and static site will look with this structure:
https://github.com/mattdesl/webgl-wireframes
🎛 Test Case
For example,
index.js
which just tries to load an image with a runtime (not imported) URL.🎛 Failed Attempts
For now, I'm trying with
index.html
in thelib
folder.This is OK, but the URL needs to be
'/app/assets/foo.jpg'
which means the static site will have to be under/app
.This gives me a more correct URL pathing in the served HTML, but I get "Uncaught SyntaxError: Unexpected token <" since it's responding with the HTML instead of JavaScript.
🤔 Expected Behavior
A way to structure static sites with minimal duplication and clean URLs.
I'm also open to other ways of structuring my site with parcel, just looking for something that could work nicely with the above JavaScript test.
The text was updated successfully, but these errors were encountered: