UNPKG

@cagovweb/state-template

Version:
102 lines (73 loc) 5.19 kB
# California State Web Template NPM Package This is the NPM Package for the California State Web Template, an HTML template and website standard offered by the California Department of Technology to state agencies and departments within the State of California and beyond. The California State Web Template is designed to promote a responsive and standard look and feel to ensure a uniform user experience across state entities. The web template includes many usability, security and accessibility requirements and is updated regularly to meet evolving industry standards and best practices. The state web template is an open source project which you can find on the [CA Office of Digital Services GitHub repository](https://github.com/Office-of-Digital-Services). There are various technology versions of the web template available for consumption. Collaboration is highly encouraged and user feedback and contributions are always considered and often implemented. This package is based on [Bootstrap v5.3.3](https://www.npmjs.com/package/bootstrap/v/5.3.3) ## How to use ### React #### Option 1 - default theme ```javascript //import with default Oceanside theme - includes core JS and CSS import "@cagovweb/state-template"; ``` #### Option 2 - specific theme ```javascript //import with specific theme //Core CSS first import "@cagovweb/state-template/dist/css/cagov.core.css"; //Choose Theme import "@cagovweb/state-template/dist/css/colortheme-oceanside.css"; //Core JS last import "@cagovweb/state-template/dist/js/cagov.core.js"; ``` ### .Net Core (Visual Studio) You can use [Library Manager (LibMan)](https://learn.microsoft.com/en-us/aspnet/core/client-side/libman/libman-vs?view=aspnetcore-7.0) to automatically sync the client JS/CSS with your Visual Studio projects. #### Create `libman.json` in your project root folder ```json { "version": "1.0", "libraries": [ { "provider": "jsdelivr", "library": "@cagovweb/state-template@latest", "destination": "wwwroot/lib/state-template/" } ] } ``` #### In your layout files you can reference the files in the `lib` folder ```html <link href="~/lib/state-template/dist/css/cagov.core.min.css" rel="stylesheet"> <link href="~/lib/state-template/dist/css/colortheme-oceanside.min.css" rel="stylesheet"> <script src="~/lib/state-template/dist/js/cagov.core.min.js"></script> ``` ### Eleventy **`.eleventy.js`** [(see reference)](https://www.11ty.dev/docs/copy/) ```javascript module.exports = function(eleventyConfig) { // Copy state template core files to site output eleventyConfig.addPassthroughCopy({ "node_modules/@cagovweb/state-template/dist": "state-template" }); }; ``` At references in your template files ```html <head> ... <link rel="stylesheet" href="state-template/css/cagov.core.min.css"/> <link rel="stylesheet" href="state-template/css/colortheme-oceanside.min.css"/> <script type="text/javascript" src="state-template/js/cagov.core.min.js"></script> </head> ``` ## Documentation For more information on how to use the state web template, please visit [webstandards.ca.gov](https://webstandards.ca.gov/template/). There you will find documentation on how to get started, how to customize the template, how to follow the web standards and best practices, and how to join the community of web developers and designers working with the state web template. You can also visit [template.webstandards.ca.gov](https://template.webstandards.ca.gov/) to see examples of websites built with the state web template and learn more about the upcoming design system that will replace the state web template in the future. ## License The state web template is licensed under the MIT License. See [LICENSE](https://github.com/Office-of-Digital-Services/California-State-Web-Template-Development/blob/main/LICENSE) for details. ## Status [![npm version](https://img.shields.io/npm/v/@cagovweb/state-template?logo=npm&logoColor=fff)](https://www.npmjs.com/package/@cagovweb/state-template) [![template version](https://img.shields.io/github/package-json/v/Office-of-Digital-Services/California-State-Web-Template-Development?label=template&logo=github)](https://github.com/Office-of-Digital-Services/California-State-Web-Template-Development/blob/main/package.json) [![license](https://img.shields.io/github/license/Office-of-Digital-Services/California-State-Web-Template-Development?logo=github)](https://github.com/Office-of-Digital-Services/California-State-Web-Template-Development/blob/main/publish/LICENSE) [![CSS gzip size](https://img.badgesize.io/Office-of-Digital-Services/California-State-Web-Template-HTML/main/ca_state_template/css/cagov.core.min.css?compression=gzip&label=CSS%20gzip%20size)](https://github.com/Office-of-Digital-Services/California-State-Web-Template-HTML/blob/main/ca_state_template/css/cagov.core.min.css) [![JS gzip size](https://img.badgesize.io/Office-of-Digital-Services/California-State-Web-Template-HTML/main/ca_state_template/js/cagov.core.min.js?compression=gzip&label=JS%20gzip%20size)](https://github.com/Office-of-Digital-Services/California-State-Web-Template-HTML/blob/main/ca_state_template/js/cagov.core.min.js)