Resource packages
Overview
Once you create pages and templates in Sitefinity CMS, you need to modify their markup and style them. You do this with the help of resource packages. They group your resources in separate folders and apply these resources on your pages and templates. A package can contain style sheets, scripts, images, task running configuration, widget templates, and layout templates.
Sitefinity CMS automatically creates a ResourcePackages
folder in the root of your project. This folder contains all resource packages. By default, with Sitefinity CMS, you get the Bootstrap 5 package but you can add your own packages in the ResourcePackages
folder.
You can have several packages with different package names. However, specific page or page template can only use one package. You associate resource packages with a template or a page by adding a template with the resource package. You can also edit an existing template. For more information, see Page templates.
Bootstrap resource packages
PREREQUISITES: When working with Resources packages and Bootstrap 5, you need Node.js and npm installed. For more information, see Introduction to Node.js on Node.js
site.
Sitefinity CMS comes with the Bootstrap 5 package installed out-of-the-box. The package includes the capabilities of the respective Bootstrap front-end framework version. For more information, see the Bootstrap site.
NOTE: As of version 14.1, Sitefinity CMS ships with the Bootstrap 5 resource package only, and this is the officially supported Bootstrap version. If you need to use Bootstrap 3 or Bootstrap 4, you must add it manually. You can download it by going to the Feather GitHub repo and filtering by tags to a version prior to 14.1.
For more information about the structure of the Bootstrap package and the location of front-end assets, see Bootstrap 5 GitHub repository.
The Sitefinity CMS Bootstrap package contains front-end assets, CSS source files, widget templates, based on the framework, such as News, Blogs, Images, and so on.
Тhe Bootstrap 5 package provides the following benefits:
- Npm scripts infrastructure
Bootstrap 5 comes with build infrastructure that uses npm scripts. To enhance customization capabilities, Bootstrap 5 package provides you with various configuration options in package.json
. Such options include package distribution folder name, styles distribution folder name, main SCSS import file name, and so on.
- SVG icons with
Font Awesome
The Bootstrap 5 package uses Font Awesome
with solid SVG icon sprites. All icons are vector graphics, so you can easily scale them while maintaining perfect quality. For more information, see the official documentation of Font Awesome about SVG sprites.
- RTL support
With Bootstrap 5, RTL support for multilingual sites is aligned with Bootstrap RTL approach. RTLCSS project is used to build 2 versions of the main CSS file, for LTR and RTL, from one code base. Which CSS file is loaded is determined in the layout file depending on the page language.
- Accessibility improvements
With the Bootstrap 5 package you easily meet accessibility standards such as WCAG 2.1 Level AA or section 508. Bootstrap 5 follows the most common accessibility best practices for developers and provides out-of-the-box support for:
- Keyboard support
- Enhanced error handling
- Forms that meet accessibility standards
- Wai-aria
- Automatic detection of page language
- Accessible captcha
NOTE: Keep in mind that meeting website accessibility standards is a collective effort that requires designers, developers, and content authors working together. This is an iterative process, and each subsequent change must be made with accessibility in mind and be properly tested.
To get better acquainted with website accessibility standards and important tips, check the following:
Bootstrap and responsive design
Bootstrap front-end framework enables you to build and develop apps that are responsive, mobile-first, and work seamlessly on any device – desktop or mobile. All MVC widgets are built with a mobile-first mindset and their responsive design is based on the Bootstrap front-end framework.
NOTE: The Navigation widget is an exception. For more information, see Add customizable grid widgets to MVC templates.
For details on the supported browsers and devices by Bootstrap, see Bootstrap 5.
Following are a few essential best practices to keep in mind when developing CSS or custom grid widgets in regard to responsive design and Bootstrap:
Minimal resource package
Minimal is a basic package, which contains all default templates of the front-end widgets, such as News, Blogs, and Images, as plain HTML, minimal CSS, and a basic grunt configuration.
RECOMMENDATION: We recommend you to use the Minimal package in case you want to use a front-end framework other than Bootstrap. Like the Bootstrap package, Minimal has a task-runner configuration that helps you to process styles, scripts, images, and so on.
The structure of the Minimal resource package is the same as that of the Bootstrap package, as it also contains minimal front-end assets, widget templates, grid widget templates, and Grunt configuration. For more information, see GitHub Minimal repository.