0.6.3 • Published 10 days ago

choco-theme v0.6.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
10 days ago

Chocolatey choco-theme

NOTE: This project is used on Chocolatey websites and is being released for the benefit of the community. While we endeavour to help and fix issues, it will be limited to GitHub issues, discussions and pull requests when we are able to.

This repository holds all of the CSS, JS, images, and shared partial files that are used across many Chocolatey projects.

Getting Started

Step 1: Setup Yarn

Install Yarn

Navigate to the root of your repository where you want the node_modules folder to be installed. Follow the directions at the below links:

  1. https://yarnpkg.com/getting-started/install#install-corepack
  2. https://yarnpkg.com/getting-started/install#initializing-your-project

A new package.json and .yarnrc.yml file will be generated after the above steps are complete.

Modify .yarnrc.yml File

In the newly generated .yarnrc.yml file, copy the following lines to the end of the document:

nodeLinker: node-modules
checksumBehavior: "update"

Modify package.json File

In the choco-theme repository, navigate to getting-started/_package.json, and copy the contents into the new package.json file that was just created in your project.

  • Be sure not to change lines 2 and 3, as these are specific to your new project.
  • Update the git information in the package.json file in your new project to the correct information.

Update .gitignore File

Add the following lines to the .gitignore file in your repository. Any file path containing input may need updated to your specific repository folder structure.

input/assets/css/
input/assets/js/
input/assets/fonts/
input/assets/images/global-shared/
input/global-partials/
apple-touch-*.png
favicon.ico
node_modules/
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

Step 2: Setup Gulp

Copy gulpfile.js File Into Your Repository

In the choco-theme repository, navigate to getting-started/_gulpfile.js, and copy the file into your new repository in the same directory as the package.json file. Change the name to gulpfile.js.

Depending on the new project setup, the variable paths in gulpfile.js may need updated. There is a block in gulpfile.js that should look similar to below:

const paths = {
    input: 'input/',
    assets: 'input/assets/',
    partials: 'input/global-partials',
    node_modules: 'node_modules/',
    theme: 'node_modules/choco-theme/'
};

Copy bundleconfig.json File Into Your Repository

In the choco-theme repository, navigate to getting-started/_bundleconfig.json, and copy the file into your new repository in the same directory as the package.json file. Change the name to bundleconfig.json.

In the bundle named input/assets/js/chocolatey.bundle.js you will need to modify the input file name to match the name of your project. Replace the ${projectName} variable.

Create a New JavaScript File

In choco-theme, you will need to copy a file inside of js/init into the same folder and name it according to the project name, and the name that you chose for the bundleconfig.json file's input path in the step above.

At this point, an informed decision will need to be made about what JavaScript files from choco-theme need to be included in the project.

Step 3: Run It!

Yarn

From the command line in the root of your repository where the package.json file is located, run the command:

yarn

This will generate the node_modules folder an install any dependencies.

Gulp

From the command line in the root of your repository where the package.json file is located, run the command:

gulp

This will generate all the CSS and JS and place images and global partials in the correct folders.

Include Assets in HTML

Directly before the closing </head> tag in your HTML document, include the following lines:

<link rel="stylesheet" href="/assets/css/chocolatey.bundle.min.css">
<script type="text/javascript" src="/assets/js/chocolatey-head.bundle.min.js"></script>

Directly before the closing </body> tag in your HTML document, include the following lines:

<script type="text/javascript" src="https://polyfill.io/v3/polyfill.min.js?features=default,Array.prototype.includes,Array.prototype.find,Number.parseFloat%2CNumber.parse%2CNodeList.prototype.forEach%2CNumber.parseInt"></script>
<script type="text/javascript" src="/assets/js/chocolatey.bundle.min.js"></script>

File paths may need to be updated based on your project structure.

Given that everything succeeded, choco-theme is set up and ready to go!

ESLint

To run ESLint on a file or folder, run the following command yarn run eslint js/filename.js. Visit the ESLint documentation for more information.

Sytlelint

To run Stylelint on a file or folder, run the following command yarn run stylelint "scss/filename.scss". Visit the Stylelint documentation for more information.

What's Included

External Libraries

Choco-theme contains many external libraries in which it depends on for various features.

IconMeaning
:clock3:Pending to be used or seasonal.
:heavy_check_mark:Currently used.
:heavy_minus_sign:Not used.
:grey_question:May or may not be used. Project may be under development.
External Librarieschocolatey.orgcommunitydocsblogdesigncompanychocolateyfest.comboxstarter.orgzendesk
jQuery:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_minus_sign::heavy_check_mark::heavy_check_mark::heavy_minus_sign::heavy_check_mark::heavy_minus_sign:
Bootstrap:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark:
Popper:heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::grey_question::heavy_check_mark::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign:
Font Awesome:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_minus_sign:
Luxon:heavy_check_mark::heavy_check_mark::heavy_minus_sign::heavy_minus_sign::grey_question::heavy_check_mark::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign:
Flatpickr:heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::grey_question::heavy_check_mark::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign:
Clipboard:heavy_check_mark::heavy_check_mark::heavy_minus_sign::heavy_minus_sign::grey_question::heavy_minus_sign::heavy_minus_sign::heavy_check_mark::heavy_minus_sign:
Chartist:heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::grey_question::heavy_check_mark::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign:
Chartist Plugin Legend:heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::grey_question::heavy_check_mark::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign:
DataTables:heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::grey_question::heavy_check_mark::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign:
AnchorJS:heavy_minus_sign::heavy_minus_sign::heavy_check_mark::heavy_check_mark::grey_question::heavy_minus_sign::heavy_minus_sign::heavy_check_mark::heavy_minus_sign:
Canvas Confetti:clock3::clock3::clock3::clock3::clock3::heavy_minus_sign::clock3::heavy_minus_sign::heavy_minus_sign:
DOCSEARCH (Algolia):heavy_minus_sign::heavy_minus_sign::heavy_check_mark::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign:
autoComplete.js:heavy_minus_sign::heavy_check_mark::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign:
EasyMDE:heavy_minus_sign::heavy_check_mark::heavy_minus_sign::heavy_minus_sign::grey_question::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign:
Mousetrap:heavy_minus_sign::heavy_check_mark::heavy_check_mark::heavy_minus_sign::grey_question::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign:
Knockout:heavy_minus_sign::heavy_check_mark::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign:
Lite YouTube Embed:heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::grey_question::heavy_minus_sign::heavy_check_mark::heavy_minus_sign::heavy_minus_sign:
Marked:heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::grey_question::heavy_check_mark::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign:
noUiSlider:heavy_check_mark::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::grey_question::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign:
Add-to-Calendar Button:heavy_check_mark::heavy_check_mark::heavy_minus_sign::heavy_minus_sign::grey_question::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign:
Prism:heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_check_mark::heavy_minus_sign::heavy_check_mark::heavy_minus_sign:
Splide:heavy_check_mark::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign:
jQuery Validation:heavy_check_mark::heavy_check_mark::heavy_minus_sign::heavy_minus_sign::grey_question::heavy_check_mark::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign:
jQuery Validation Unobtrusive:heavy_check_mark::heavy_check_mark::heavy_minus_sign::heavy_minus_sign::grey_question::heavy_check_mark::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign:
Balance Text:heavy_check_mark::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign::heavy_minus_sign:

Custom JavaScript and TypeScript

Along with external libraries, choco-theme contains many individual custom JavaScript and TypeScript files. The functions have been split up in a way that allows them to be included if desired in any project, minimizing the need for them to be required. While the majority of choco-theme is JavaScript, it is now encouraged to write any new code in TypeScript and place it in the js/ts directory. This will be converted to JavaScript when running gulp.

Custom JavaScript/TypeScriptNotes
chocolatey-alerts.jsTop banner and cookie notice.
chocolatey-anchors.jsInitializes anchor.js.
chocolatey-announcements.jsSets cookie and UI notifications for right flyout.
chocolatey-authentication.jsShows login/logout navigations based on authentication status.
chocolatey-birthday.jsEnables confetti.
chocolatey-carousels.jsPrevents carousels from auto playing on mobile that have fixed heights on desktop.
chocolatey-clipboard.jsInitializes clipboard.js.
ts/chocolatey-code.tsManually highlights code blocks with prism.js.
chocolatey-collapse-nested.jsAllows navigation to nested tabs or collapsed items.
chocolatey-collapse-responsive.jsToggles collapsed items and navigates to them.
chocolatey-collapse-topnav.jsSpecial handling for nested collapse in top navigation.
chocolatey-collapse-y-height.jsConfigures page height based on collapsed or shown items.
chocolatey-courses.jsSets cookies and manages courses when unauthenticated.
chocolatey-docs.jsSpecial handling of titles in the docs project only.
chocolatey-docsearch.jsInitializes the docsearch library for docs.chocolatey.org.
chocolatey-dropdown-hover.jsControls the top navigation hoverable dropdowns.
chocolatey-events.jsControls showing/hiding of time sensitive information in the events area.
util/chocolatey-functions.jsProvides helper functions that can be imported into any JavaScript file.
ts/util/chocolatey-functions.jsProvides helper functions that can be imported into any TypeScript file.
chocolatey-internal-url.jsSets internal url in code blocks based on user input.
chocolatey-lazyload.jsLazy loading for images and videos.
chocolatey-loader.jsShows and removes spinning Chocolatey loader.
chocolatey-markdown.jsStyles blockquotes based on emojis and checkboxes in markdown.
chocolatey-multi-tabs.jsAllows showing or hiding of multiple tabs in one click.
chocolatey-modal-auto-close.jsAuto closes a modal when an external link is clicked.
chocolatey-org.jsSpecial handling for chocolatey.org.
chocolatey-packages.jsControls interactive elements in the Chocolatey Community Repository package pages.
chocolatey-placeholders.jsGenerates random placeholder images.
chocolatey-script-builder.jsControls Chocolatey Script Builder functionality.
chocolatey-scrollspy.jsControls right hand scroll navigation highlighting to page anchors.
chocolatey-search.jsInitializes mousetrap.js and search bar interactivity.
chocolatey-show-hide.jsReplaces button text on collapse buttons based on status.
chocolatey-shuffle.jsshuffles elements around inside a container.
chocolatey-splide.jsInitiates and controls Splide carousels.
chocolatey-stats.jsGets Chocolatey Community Repository package stats and displays them on a page.
chocolatey-sticky-table.jsAllows sticky headers on tables.
chocolatey-sticky-top.jsControls top navigation look and feel when a sticky top header is enabled.
chocolatey-substrings.jsShortens long strings and provides a clickable read more link.
ts/chocolatey-tab-multiples.tsEnables connection of multiple tabs to be triggered at the same time.
ts/chocolatey-tables.tsEnables responsive tables that are generated by markdown.
chocolatey-tooltips.jsInitializes tooltips globally.
chocolatey-terminal.jsShows a typewriter effect based on given text.
chocolatey-theme-toggle-head.jsControls dark and light modes on load.
chocolatey-theme-toggle.jsControls dark and light modes on load and on change.
chocolatey-toggle-fade-show.jsManual usage of Bootstraps fade/show animations.
chocolatey-inputs.jsAdds Bootstrap classes to form elements.

Custom CSS

While choco-theme utilizes the Bootstrap framework, many custom .scss files exist that further enhance the Chocolatey look and feel.

All of the Bootstrap and custom Chocolatey .scss files are included in the build process. A gulp task is ran by the purge-css plugin that removes any unused rules. This significantly reduces the CSS footprint and maintainability.

Global Partials

Global partials are imported on-demand by each project individually. They supply content that is used across multiple projects in an effort to reduce duplication of code.

Global PartialsNotes
AlertText.txtThe text for the top alert banner. This can be empty if no alert is wanted.
CollapsingRightSidebarContent.txtHolds content for the right side flyout.
globalnavigation.txtGlobal navigation element.
socialmedia.txtSocial media follow buttons mainly found in project footers.
svgstyles.txtProvides inline styles for svg's using CSS variables.
TermsContent.htmlThe content on terms pages.
TermsLastUpdated.txtThe last updated date of terms pages.
TermsToc.htmlThe table of content navigation on terms pages.
ThemeToggle.txtTop navigation dark or light theme switcher.
TopAlertBanner.txtWhen alert text is supplied, this element will be shown in the top navigation.
0.6.3

10 days ago

0.6.2

12 days ago

0.6.1

13 days ago

0.6.0

17 days ago

0.5.28

1 month ago

0.5.27

2 months ago

0.5.25

2 months ago

0.5.26

2 months ago

0.5.24

3 months ago

0.5.23

3 months ago

0.5.22

3 months ago

0.5.21

4 months ago

0.5.20

4 months ago

0.5.19

4 months ago

0.5.18

4 months ago

0.5.17

5 months ago

0.5.10

9 months ago

0.5.11

9 months ago

0.5.9

9 months ago

0.5.16

5 months ago

0.5.14

6 months ago

0.5.15

6 months ago

0.5.12

9 months ago

0.5.13

7 months ago

0.5.8

10 months ago

0.5.7

11 months ago

0.5.4

11 months ago

0.5.3

12 months ago

0.5.6

11 months ago

0.5.5

11 months ago

0.5.0

12 months ago

0.4.1

1 year ago

0.5.2

12 months ago

0.5.1

12 months ago

0.4.2

1 year ago

0.4.0

1 year ago

0.3.0

1 year ago

0.2.9

1 year ago

0.3.1

1 year ago

0.2.8

1 year ago

0.2.7

1 year ago

0.1.12

1 year ago

0.1.13

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.2.6

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.5

1 year ago

0.2.4

1 year ago

0.1.11

1 year ago

0.1.10

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago