Skip to content
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

Update installation instructions #139

Merged
merged 1 commit into from
Feb 16, 2021
Merged

Conversation

KittyGiraudel
Copy link
Owner

@fvsch Would you mind reviewing it please? 😊

SUMMARY.md Outdated Show resolved Hide resolved
README.md Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@KittyGiraudel KittyGiraudel merged commit 1f6b1af into main Feb 16, 2021
@KittyGiraudel KittyGiraudel deleted the install-instructions branch February 16, 2021 15:52
Copy link

@fvsch fvsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the fixed jsdelivr URLs, this looks good to me. It’s a pretty good guide to installing the library, and nicely corrects the issue I raised.

I have a few more readability suggestions, feel free to us them or not.

defer
src="https://cdn.jsdelivr.net/npm/a11y-dialog@6.0.0/dist/a11y-dialog.esm.min.js"
type="module"
></script>
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure there’s a lot of value in loading a11y-dialog as a ES Module if not importing anything, vs loading it as a UMD module (which would add the window.A11yDialog function).

Maybe including that ESM example here is overkill, and it could be removed.

Another option is to show a more interesting example:

<script type="module">
  import A11yDialog from 'https://cdn.jsdelivr.net/npm/a11y-dialog@6.0.0/a11y-dialog.esm.min.js'
  const el = document.getElementById('your-dialog-id')
  const dialog = new A11yDialog(el)
</script>

But then the lines after the import are spoiling the Usage section. :P

Maybe something like:

<script type="module">
  import A11yDialog from 'https://cdn.jsdelivr.net/npm/a11y-dialog@6.0.0/a11y-dialog.esm.min.js'
  // See Usage section on how to use the A11yDialog contructor
</script>

></script>
```

If you intend to use ES modules, you can use the ESM version of script (from v6.0.0 onwards only):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: "starting from v6.0.0 only", if that’s easier for an English as a 2nd/3rd/4th language audience?

(I do like "onwards" personally.)


### Using a CDN

If you prefer loading `a11y-dialog` from a third-party CDN such as jsdelivr, you can do so by adding this script tag in your HTML (use the version of your choice—ideally the latest one):
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conciseness: I feel that "(use the version of your choice—ideally the latest one)" could be removed.

  • It's a bit misleading: the paths provided will work only on v6+ anyway (maybe on next major releases if they don’t change the dist structure).
  • It’s not clear: it suggests doing one thing (pick a different version if you want) but then interrupts to advise something else (do use the latest version).

That level of detail is probably not useful in this short “Installation” section. We want to get users over the installation hurdle quickly, so that they can focus on the Usage parts sooner than later.

A feature of jsdeliver and unpkg that can be interesting: you can use version numbers in URLs as you would do with npm install or in package.json constraints. So to have a URL that doesn't need to be changed in the README for every release, you could use:

https://cdn.jsdelivr.net/npm/a11y-dialog/dist/a11y-dialog.min.js

If you want to reserve the possibility to change the output file names in v7, include the MAJOR number:

https://cdn.jsdelivr.net/npm/a11y-dialog@6/dist/a11y-dialog.min.js

and if you want to be more cautious, at the cost of more churn in the README, you can use MAJOR.MINOR:

https://cdn.jsdelivr.net/npm/a11y-dialog@6.0/dist/a11y-dialog.min.js

Personally, I’d go with using /a11y-dialog@6/ in the URL. For users, this does mean that their site may automatically load 6.0.1 when they start development, 6.1.0 when they go live, and 6.13.4 some day down the line. MAJOR.MINOR would be a bit more conservative. Depends on what this project’s track record for following semver is. :D

@KittyGiraudel
Copy link
Owner Author

Further comments addressed in #140.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants