Feather: Work with framework packages
Once you install Feather and choose a frontend framework to use for your website, you can start to write CSS files in the package folder of the respective framework. Another option is to duplicate the package folder of the framework and work there. If you choose the latter, you can affect the upgrade process later on. Make sure you follow the instructions in Upgrade the Feather package below.
Use the GruntJS infrastructure
Feather uses the GruntJS infrastructure, which is a NodeJS based task runner, used for automating the frontend workflow. For more information, see http://gruntjs.com/.
When generating Feather packages, the task runner also compiles SASS
files, compresses CSS
and JS
files, creates sprites, and optimizes images.
To use the GruntJS infrastructure, perform the following:
- Install NodeJS from http://nodejs.org/.
- Open up a command prompt or a bash terminal and navigate to the package folder.
For example, /ResourcePackages/Bootstrap
- To install GruntJS and all other
npm
packages that you need to use, in the command line, type npm install .
- To start monitoring for changes and to run all GruntJS tasks, type grunt.
If you want to concatenate and unite js files into one file:
- Place all your js files in the
assets/src/project/js
folder.
- NOTE: We recommend loading one js file at a time to reduce requests to the server and speed up your site.
- In the
jsfiles.json
, define the order, in which the project's js files are concatenated and united. For example:
{
"concatJsFiles"
: [
"assets/src/project/js/project-file-1.js"
,
"assets/src/project/js/project-file-2.js"
]
}
As a result, after you run grunt, all js files listed in the jsfiles.json
file, are processed and output to the assets/dist/js/project.min.js
folder.
Import source files of frontend frameworks
Feather supports the Bootstrap framework.
The Bootstrap source files are included in the CSS generated for each framework package. The styles.sass
file is located in /assets/src/sass
. Once you open the file, you can see an @import
that has content similar to @import "../../../node_modules/bootstrap-sass/assets/stylesheets/bootstrap.scss";
The @import
includes the whole Bootstrap framework and gives you flexibility in terms of customization. If you know which Bootstrap components you are going to use in your website, you can include only the components that you need. As a result, the generated CSS file will be smaller and take up less space.
The same is true for the @import
of the Foundation source files.
The source files are located in the following folder /node_modules/bootstrap-sass/
Override variables of source files
Once you import the source files of a frontend framework, you can change the variables the framework exposes and, thus, customize their predefined values.
For example, the Bootstrap framework has variables that define the breakpoints for the responsive design features. Breakpoints depend on the website design and are not universal, so Feather enables you to redefine these variables according to your design requirements.
You can find the Bootstrap breakpoint variables in folder \node_modules\bootstra-sass\assets\stylesheets\bootstrap
in file _variables.sass
. You can locate breakpoint variables by searching for //== Media queries breakpoints
. Each variable is defined with a !default
tag.
If, in your SASS files, you define a variable with the same name as a predefined Bootstrap framework variable, your new variable overrides the Bootstrap default variable value.
Upgrade frontend frameworks
You load the Bootstrap as a package by using the npm
command in your command line. As a result, in the packages.json
file, you can see a list of all installed npm packages. The .json
file is located in the root of every Feather package folder.
When you open the package.json
file of the Bootstrap package, you can see its version - for example, 3.3.1.
To upgrade to the latest version of Bootstrap, perform one of the following:
- When you open the root folder of the package, in your command line, type npm update
- Open the
package.json
file, change the package version manually, and, in the command line, type npm install
Upgrade the Feather package
You upgrade the Feather package in one of the following ways: