The Creative Commons License Chooser is meant to help people learn about CC licenses, and select the license that best fits their needs. The new version in this repo places greater importance on usability, and an educational experience of the six CC licenses.
Repository containing the source code for the new Creative Commons License Chooser. The new chooser is still in beta, and a beta deployment can be found here.
This site is built using Vue.js (and vue-cli).
Tasks, issues, and discussion related to the release of the new chooser are tracked with the Launch Milestone
.
The Creative Commons team is committed to fostering a welcoming community. This project and all other Creative Commons open source projects are governed by our Code of Conduct. Please report unacceptable behavior to conduct@creativecommons.org per our reporting guidelines.
See CONTRIBUTING.md
.
The docker-compose.yml
file defines the following
containers:
- chooser-web - simple NGINX container serving
docs/
- chooser-node - Node14 container
- localhost:8080
- (requires Run Node development server, below)
- localhost:8080
Before proceeding, ensure you have Docker installed on your local machine. If not, download and install Docker Desktop by visiting Docker's official website and follow the installation instructions.
The containers can be started with:
docker compose up
(See Docker Compose overview | Docker Docs
for more information on managing containes with docker compose
.)
Before the chooser-node container can be used effectively, a clean install of
NPM packages from package-lock.json
is required:
docker compose exec chooser-node npm ci
This step generally only needs to be done once.
- Startup containers (see above)
- Complete initial setup (see above)
- Run Node development server
docker compose exec chooser-node npm run serve
- Startup containers (see above)
- Complete initial setup (see above)
- Run Node development server
docker compose exec chooser-node npm run build
The chooser is deployed to GitHub Pages. The source files for the beta
deployment are contained in the ./docs/
dir, and are live. Any changes to
this directory's contents will be automatically deployed, so please take care
when making modifications to this location.
- Startup containers (see above)
- Complete initial setup (see above)
- Run Node development server
docker compose exec chooser-node npm run build
The chooser is deployed to GitHub Pages. The source files for the beta
deployment are contained in the ./docs/
dir, and are live. Any changes to
this directory's contents will be automatically deployed, so please take care
when making modifications to this location.
For an embedded standalone build (no header nor footer), run:
docker compose exec chooser-node VUE_APP_CC_OUTPUT=embedded npm run build
(please don't commit embedded builds to docs/
)
- Startup containers (see above)
- Complete initial setup (see above)
- Run Node development server
docker compose exec chooser-node npm run build-component
This will create a file in the dist/
folder named
license-chooser.min.js
. It can be used to load the web-component in any JS
project. There is also a sample demo.html
created.
To be able to use the file it should either be rendered statically from the integrater's web-app or be published on a CDN. Following code can be used to integrate this in other apps.
Note: the Chooser component depends on Vue 2.x, as can be seen in the following example.
<script src="https://cdn.jsdelivr.net/npm/vue@2.x.x"></script>
<script src="https://unpkg.com/@creativecommons/chooser/dist/license-chooser.js"></script>
<license-chooser></license-chooser>
For an embedded web component build (no header nor footer), run:
docker compose exec chooser-node VUE_APP_CC_OUTPUT=embedded npm run build-component
- Startup containers (see above)
- Complete initial setup (see above)
- Run unit tests
docker compose exec chooser-node npm run test:unit
- Startup containers (see above)
- Complete initial setup (see above)
- Create a web component build (see above)
- Run unit tests
docker compose exec chooser-node npm run test-component
- It starts a server with the
dist/demo.html
on which tests can be run.
- It starts a server with the
- Startup containers (see above)
- Run Cypress tests
docker run -it -v $PWD:/e2e -w /e2e -e CYPRESS_baseUrl=http://host.docker.internal:8888 cypress/included:latest
- (This will download the cypress/included image when first run)
The Chooser uses PostCSS plugin for PurgeCSS to make CSS bundle size smaller.
It automatically removes unused CSS based on the classes found in the final
built bundle. Some styles for dynamic components or dynamically-imported files
can also be removed. If you find that the built site misses some styles, you
can manually add the necessary classes or Regex expressions to the safelist
array in the postcss.config.js
file.
The site can be built in two different modes: embedded
and standalone
.
Embedded
mode removes the header and footer from the application, resulting
in the following appearance:
To build into embedded mode, set the environment variable
VUE_APP_CC_OUTPUT=embedded
on your server before building. If
VUE_APP_CC_OUTPUT
is unset or set to a different value, the app will build in
the default standalone mode, with its own header and footer.