Comments (11)
So from what I gathered so far, here's what we want to achieve:
- Track the CSS (or other pre/post processor) sources in the repository.
- Generate the CSS resources before or during build time (lint, minify, etc).
- Since we can't load these at runtime (SPM limitation), we have to inject them during build time.
For 1, can we consider using Sass or PostCSS for taking care of things like auto-prefixing, polyfills, etc?
For 2, I guess webpack is a good place to start. Not my favorite in terms of overhead, but we can try to keep the config manageable.
For 3, I guess auto-generating the Swift file is one option. Any others that we can consider?
from swift-doc.
@kaishin Done. Have fun!
from swift-doc.
The same pipeline can be used to take our icons and inline them into our CSS
from swift-doc.
@mattt This is the issue we discussed earlier, right?
from swift-doc.
@kaishin Indeed it is. Any thoughts / opinions?
from swift-doc.
Oh and we have also to decide how running webpack commands will fit in the workflow. Doing it manually is likely going to be error-prone.
from swift-doc.
Oh and we have also to decide how running webpack commands will fit in the workflow. Doing it manually is likely going to be error-prone.
Here are a few options to consider:
Option A: Add a call to webpack
in our Makefile
before we run swift build
; this would guarantee consist results with derivative asset files, but would introduce npm
as a hard dependency for (manual / non-bottled) installation.
Option B: Add webpack
to a git pre-commit hook; this has the benefits of A without making npm
a hard dependency (you only need it as a contributor, not a user). However, git hooks are inconvenient to setup.
Option C: Accept the possibility of stale assets in builds.
Right now, I'm towards Option C.
If you're working on the design of the HTML docs, you're almost certainly running webpack
every time you make a change to see the result (perhaps automatically with a Guardfile
or the like). When you're done working, and it comes time to commit the changes, any derivative files would be already generated — fresh and ready to go.
The one situation where this would fail, though, is with conflict resolution. If I merge a PR that changes a source asset, I may need to re-run webpack
to refresh the results. I think it'd be possible to write a GitHub Action to do this automatically, but I'd defer that work until it's proven to be necessary.
from swift-doc.
So from what I gathered so far, here's what we want to achieve:
- Track the CSS (or other pre/post processor) sources in the repository.
- Generate the CSS resources before or during built time (lint, minify, etc).
- Since we can't load these at runtime (SPM limitation), we have to inject them during build time.
For 1, can we consider using Sass or PostCSS for taking care of things like auto-prefixing, polyfills, etc?
Absolutely. I have a slight preference for PostCSS if it's convenient, but Sass is fine too.
For 2, I guess webpack is a good place to start. Not my favorite in terms of overhead, but we can try to keep the config manageable.
Actually, taking another look at the available options, I think Parcel looks a bit more palatable, at least for an MVP.
For 3, I guess auto-generating the Swift file is one option. Any others that we can consider?
Alternatively, we can just copy the files into the built documentation directory, and have our HTML point to where they'll be. Inlining CSS was something I did primarily to get beta 1 out the door.
from swift-doc.
Absolutely. I have a slight preference for PostCSS if it's convenient, but Sass is fine too.
Cool, I can set that up. It's my preference too.
Actually, taking another look at the available options, I think Parcel looks a bit more palatable, at least for an MVP.
Let's go with Parcel for now. I looked at it a while back and it seemed nicer.
Alternatively, we can just copy the files into the built documentation directory, and have our HTML point to where they'll be. Inlining CSS was something I did primarily to get beta 1 out the door.
I prefer this option as well. Keeps things tidy at a negligible cost.
Right now, I'm towards Option C.
C it is. I was going to pitch A initially but you bring up good points about the hard npm dependency.
from swift-doc.
@mattt Can you assign me to this issue? Not able to do that myself...
from swift-doc.
@mattt Let's continue the discussion on the PR draft directly :)
from swift-doc.
Related Issues (20)
- Operators are not included in the generated documentation if there are multiple operators with the same name
- Add designs to accommodate all types of callout in discussion in HTML output HOT 1
- Add section to README for troubleshooting installation HOT 1
- Character substitution in file names can lead to collisions HOT 1
- Localize generated output HOT 1
- Migrate from Docker Hub to GitHub Container Registry HOT 1
- Improve estimation of diagram boxes
- Feature Request: support x-source-tag
- Loud GitHub diffs
- Feature Idea: HTML folders based on project folders HOT 1
- Comment tags are not recognized HOT 3
- Generate Diagram in Swift-doc
- Documentation links to non-existent internal protocols HOT 2
- Group management
- `Error: The loaded '_InternalSwiftSyntaxParser' library is from a toolchain that is not compatible with this version of SwiftSyntax` HOT 2
- Support for local html file browsing
- Feature request: Declarations with a documentation comment containing `:nodoc:` are excluded from the documentation.
- Error to load CSS in Index.html [Fix] [CSS] HOT 2
- Displaying documentation coverage with GitHub Action?
- Documentation coverage report
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swift-doc.