|
| 1 | +# Base project for markup used for kodexe (*no neat/bourbon*) |
| 2 | + |
| 3 | +## First time using this repository? |
| 4 | +- If you do not have Node installed already, you can get it by downloading the package installer from [Node's website](https://nodejs.org/en/). |
| 5 | + |
| 6 | +- Then install Gulp globally: |
| 7 | +``` |
| 8 | +$ sudo npm install gulp -g |
| 9 | +``` |
| 10 | + |
| 11 | +- Locate yourself into the _sites_ folder and clone the repository (not needed if you are using Tower) |
| 12 | +``` |
| 13 | +$ git clone [email protected]:bigsouth/white-label-markup-kodexe.git |
| 14 | +``` |
| 15 | + |
| 16 | + |
| 17 | +## Creating a new project |
| 18 | + |
| 19 | +### With Tower |
| 20 | + |
| 21 | +- Create a new repository in [Bitbucket](https://bitbucket.org/). Preferably **without** a .gitignore or readme.md, to avoid conflicts. |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | +- Start Tower and clone the white-label-markup-kodexe repository to a new folder |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +- Enter the repository and right click the remote origin and select **Edit connection settings...** |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +- Change the last part of the remote URL to the created repository in Bitbucket and click 'Change' |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | +- Edit the name in _package.json_ and update the _readme.md_ in your favorite code editor and commit your changes |
| 38 | + |
| 39 | +- Commit the changes and then push everything to the new repository. |
| 40 | + |
| 41 | +- Place yourself into the new repository and run the following to install all dependencies: |
| 42 | +``` |
| 43 | +$ npm install |
| 44 | +``` |
| 45 | + |
| 46 | +- Start the engine: |
| 47 | +``` |
| 48 | +$ npm start |
| 49 | +``` |
| 50 | + |
| 51 | + |
| 52 | +### The automated way |
| 53 | + |
| 54 | +- Create a new repository in [Bitbucket](https://bitbucket.org/) |
| 55 | + |
| 56 | +- Locate yourself into the white-label-markup-kodexe folder (_sites/white-label-markup-kodexe_) and **pull** the latest changes on the master. |
| 57 | + |
| 58 | +- Run the `create_project.sh` script and enter the created repository's name. The name is found at the end of the bitbucket url. |
| 59 | + |
| 60 | +https://bitbucket.org/bigsouth/**white-label-markup-kodexe** |
| 61 | + |
| 62 | +``` |
| 63 | +$ ./create_project.sh |
| 64 | +``` |
| 65 | + |
| 66 | +- Locate yourself into the new folder |
| 67 | +``` |
| 68 | +$ cd ../<repository name> |
| 69 | +``` |
| 70 | + |
| 71 | +- Change the project name in the package.json file |
| 72 | + |
| 73 | +- You are now ready to go! Start the server |
| 74 | +``` |
| 75 | +$ npm start |
| 76 | +``` |
| 77 | + |
| 78 | +### Do it yourself |
| 79 | + |
| 80 | +- Create a new repository in [Bitbucket](https://bitbucket.org/) |
| 81 | + |
| 82 | +- Locate yourself into the _sites_ folder on your computer and clone the git repo to a wanted folder `<folder name>`: |
| 83 | +``` |
| 84 | +$ git clone [email protected]:bigsouth/white-label-markup-kodexe.git <folder name> |
| 85 | +``` |
| 86 | + |
| 87 | +- Enter the folder |
| 88 | +``` |
| 89 | +$ cd <folder-name> |
| 90 | +``` |
| 91 | + |
| 92 | +- Pull the latest changes: |
| 93 | +``` |
| 94 | +$ git pull |
| 95 | +``` |
| 96 | + |
| 97 | +- Change the remote to your created repository `<repository>` |
| 98 | +``` |
| 99 | +$ git remote set-url origin [email protected]:bigsouth/<repository>.git |
| 100 | +``` |
| 101 | + |
| 102 | +- Update the repository: |
| 103 | +``` |
| 104 | +$ git push -f origin master |
| 105 | +``` |
| 106 | + |
| 107 | +- Checkout a new feature branch `<branch name>` |
| 108 | +``` |
| 109 | +$ git checkout -b feature/<branch name> |
| 110 | +``` |
| 111 | + |
| 112 | +- Install all dependencies: |
| 113 | +``` |
| 114 | +$ npm install |
| 115 | +``` |
| 116 | + |
| 117 | +- Start the engine: |
| 118 | +``` |
| 119 | +$ npm start |
| 120 | +``` |
| 121 | + |
| 122 | +# Tips |
| 123 | + |
| 124 | +#### Creating a clean build |
| 125 | +Run the following to build a clean version of the project: |
| 126 | +``` |
| 127 | +$ npm run build:clean |
| 128 | +``` |
| 129 | +The output is found in _build/_ |
| 130 | + |
| 131 | + |
| 132 | +#### Creating a clean build with critical css for all files |
| 133 | +``` |
| 134 | +$ npm run build:all-critical |
| 135 | +``` |
| 136 | +The output is found in _build/_ and the generated critical css in _crititcalCSS/_ |
| 137 | + |
| 138 | + |
| 139 | +#### Deploy the build to _/clients_ |
| 140 | +Deploy a build to a sub directory on bigsouth.se: |
| 141 | +``` |
| 142 | +$ npm run deploy |
| 143 | +``` |
| 144 | + |
| 145 | + |
| 146 | +#### Including templates |
| 147 | +Use `<include>`-tags to include other templates in the current template. The following example will include all the content found the template _tabs.html_: |
| 148 | +```html |
| 149 | +<include src="tabs.html"></include> |
| 150 | +``` |
| 151 | + |
| 152 | + |
| 153 | +#### Using template variables |
| 154 | +Using the following templates: |
| 155 | +_index.html_: |
| 156 | +```html |
| 157 | +<include src="filename.html" label="Lorem ipsum dolor sit amet"> |
| 158 | + <input type="text" /> |
| 159 | +</include> |
| 160 | +``` |
| 161 | +_filename.html_: |
| 162 | +```html |
| 163 | +<label>@@label: @@content</label> |
| 164 | +``` |
| 165 | +results in: |
| 166 | +```html |
| 167 | +<label>Lorem ipsum dolor sit amet: <input type="text" /></label> |
| 168 | +``` |
0 commit comments