Centrally Deployed Templates Solution (CDTS)
The purpose of the Centrally Deployed Templates Solution (CDTS) is essentially to deliver the presentation layer of the Canada.ca
or intranet.canada.ca
themes to web assets. It decouples the presentation layer from the business logic of a static website or web application and allows rapid updates across multiple networks.
Please visit our documentation for more information about the project.
Working with this repository
Requirements
To work with this project you will need node.js and npm installed. This project was created with:
- node.js v12.14.0
- npm 6.13.4
- java version "1.8.0_201"
- Java(TM) SE Runtime Environment (build 1.8.0_201-b26)
For ESDC employees Please read ESDC Proxy Scripts if it's your first time connecting to github from your work computer.
Security
Please see SECURITY.md for more information.
Install dependencies
Clone this repository to a local directory. On the command line move to the cloned directory ( this directory should contain the package.json file) and run : $ npm install
.
This command will read the package.json and install the npm dependencies to the node_modules directory.
Builds
The soy files are compiled with grunt-soy-compile.
This project uses the nodeJS and npm modules to get the dependencies needed, build, minify and deploy the final JavaScript modules.
Development
To create a development build of the modules on the command line move to the cloned directory and run: $ npm run build
This command will:
- Empty the
dist
andtmp
folder - Compile the soy files using grunt-soy-compile into the
tmp
folder - Copy and rename and concat the compiled
js
files into thedist
- Copy the
gcweb
andwet-boew
files from thenode_modules
folder in thedist
- Copy all the other assets (JS, CSS, HTML) files from the
_src
in thedist/cdts
folder - Delete the
tmp
folder
To Do:
- Setup git submodules for sample pages, added issue #7
- Use a CI to tests source code, added issue #8
- Use CI to deploy
dist
folder to servers, added issue #9
Related repositories
cdts-sgdc-cdn
Used to host the dist
folder to be able to pull to different servers. Travis.CI is used to build and then deploy to these secondary repositories within the coffee scripts. Will create a branch with the curent version number. And tags for releases.
cdts-sgdc-dist
Not sure what this is for but WET has it. Might get rid of it, might keep it. WET uses to host all their working files.
cdts-sgdc-releases
Holds all the releases so that servers can pull from this repository onto the CDNs.
Grunt tasks scripts breakdown
npx grunt
default: Default task that runs the core unminified build
npx grunt dist
dist: Produces the production files, which is build
+ minify
npx grunt build
build: Run full build.
npx grunt minify
minify: Minify built files.
npx grunt deploy
deploy: Build and deploy artifacts to cdts-sgdc-cdn (Only works on Travis-ci.org)
Nice to have
- Sass or post-css
- Something to generate the sample HTML files (jekyll)
New DNS structure
We would like to setup a new DNS new path for the CDTS JS files.
Looking at maybe one of these:
- sgdc-cdts.canada.ca/v1.0.1/cdts/js/gcweb-en.js
- cdts.canada.ca/v1.0.1/cdts/js/gcweb-en.js
- sgdc.canada.ca/v1.0.1/cdts/js/gcweb-en.js
License
Unless otherwise noted, the source code of this project is covered under Crown Copyright, Government of Canada, and is distributed under the MIT License.
The Canada wordmark and related graphics associated with this distribution are protected under trademark law and copyright law. No permission is granted to use them outside the parameters of the Government of Canada's corporate identity program. For more information, see Federal identity requirements.