Skip to content

Commit 5937828

Browse files
committed
first commit
0 parents  commit 5937828

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2046
-0
lines changed

.ecrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"exclude": [
3+
"node_modules",
4+
"app",
5+
"vendor",
6+
"gulpfile.js",
7+
"package.json",
8+
"\\.md$",
9+
"\\.php$"
10+
]
11+
}

.editorconfig

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# editorconfig.org
2+
root = true
3+
4+
[*]
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = tab
8+
indent_size = 4
9+
charset = utf-8
10+
trim_trailing_whitespace = true
11+
insert_final_newline = true
12+
13+
[*.md]
14+
trim_trailing_whitespace = false

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/node_modules
2+
/app
3+
package-lock.json
4+
.idea

.htmlhintrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"attr-lowercase": false,
3+
"doctype-first": false
4+
}

.prettierrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"semi": false,
3+
"singleQuote": true,
4+
"endOfLine": "auto",
5+
"htmlWhitespaceSensitivity": "ignore",
6+
"printWidth": 120,
7+
"trailingComma": "none",
8+
"bracketSameLine": true,
9+
"jsxBracketSameLine": true
10+
}

README.md

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
gulp-starter <a href="https://github.com/tagtwp/gulp-starter/stargazers"><img src="https://img.shields.io/github/stars/tagtwp/gulp-starter" alt="Stars Badge"/></a>
2+
===
3+
4+
Installation
5+
---------------
6+
7+
### Requirements
8+
9+
`gulp-starter` requires the following dependencies:
10+
11+
- [Node.js](https://nodejs.org/)
12+
- [Gulp.js](https://gulpjs.com/)
13+
14+
### Quick Start
15+
16+
To work with this build, clone the entire contents of the repository using:<br>
17+
18+
`git clone <this repo>`
19+
20+
After cloning, navigate to the main project folder and run the following command to install all necessary dependencies specified in the package.json file:<br>
21+
22+
```shell
23+
npm install
24+
```
25+
26+
Once the dependencies are installed, you can use any of the available build commands. The resulting files will be placed in the `app` folder in the root directory:
27+
28+
```shell
29+
npm run dev
30+
```
31+
The base command that starts the build process for development.
32+
33+
```shell
34+
npm run build
35+
```
36+
Builds the project, optimizing and compressing all files for hosting.
37+
38+
```shell
39+
npm run cache
40+
```
41+
Run this command after gulp build if you need to upload new files to the hosting without using caching.
42+
43+
```shell
44+
npm run backend
45+
```
46+
Builds the backend part of the project. This build contains only the necessary elements and is not compressed, making it convenient for backend development.
47+
48+
```shell
49+
npm run zip
50+
```
51+
Packs your finished code into a zip archive.
52+
53+
```shell
54+
npm run deploy
55+
```
56+
Creates a temporary clone of the current repository, generates a gh-pages branch if it doesn't already exist, copies all files from the base path (or those matching patterns from the optional src configuration), commits all changes, and pushes to the origin remote.
57+
58+
`By following these steps, you'll be set up to work with the project efficiently.`
59+
60+
### 📝 Folder and file structure
61+
```
62+
├── gulp/ # All Gulp build settings, divided into separate files
63+
├── src/ # Sources
64+
│ ├── js # Scripts
65+
│ │ └── main.js # Main script
66+
│ │ ├── _components.js # component connection file
67+
│ │ ├── components # js components
68+
│ │ ├── _functions.js # File with ready-to-use js functions
69+
│ ├── styles # Main styles folder
70+
│ │ └── main.scss # Main style file
71+
│ │ └── vendor.scss # File for connecting library styles from the vendor folder
72+
│ │ └── _fonts.scss # File for connecting fonts (you can use myxin)
73+
│ │ └── _mixins.scss # File for connecting mixins from the mixins folder
74+
│ │ └── _vars.scss # File for writing css or scss variables
75+
│ │ └── _base-variables.scss # File with global variables
76+
│ │ └── _colors-variables.scss # File with color variables
77+
│ │ └── _offset-system-variables.scss # File with offset system variables
78+
│ │ └── _reset.scss # File with global tag reset
79+
│ │ └── _settings.scss # File for writing global styles
80+
│ │ └── _unitary-classes.scss # File with unitary classes that are reused throughout the project
81+
│ │ ├── components # scss components
82+
│ │ ├── mixins # folder for saving finished mixins components
83+
│ │ ├── vendor # folder for storing local css styles of libraries
84+
│ ├── components # folder for storing html partials of the page
85+
│ ├── pages # folder for storing html pages of the project
86+
│ ├── img # folder for storing img
87+
│ │ ├── svg # special folder for converting svg to sprite
88+
│ ├── assets # folder for storing other assets - php, video files, favicon, etc.
89+
│ │ ├── fonts # folder for storing fonts in woff2 format
90+
│ └── index.html # Main html file
91+
└── gulpfile.js # Gulp configuration file
92+
└── package.json # file with build settings and installed packages
93+
└── .editorconfig # file with code formatting settings
94+
└── .ecrc # editorconfig-checker package settings file (excludes unnecessary folders)
95+
└── .prettierrc # Prettier settings file
96+
└── README.md # README build
97+
```
98+
99+
### 📁 Working with html
100+
101+
Using **gulp-file-include**, you can divide an HTML file into various templates, which should be stored in the **components** folder.
102+
103+
---
104+
> [!NOTE]
105+
> **To insert HTML parts into the main file, use `@include('components/filename.html')**
106+
---
107+
When you run the `gulp build` command, all HTML files will be minified into a single line of code.
108+
109+
### 📁 Working with CSS
110+
111+
In build, the **sass** preprocessor in **scss** syntax is used.
112+
113+
Styles written in **components** should be plugged into **main.scss**.
114+
115+
To connect third-party css files (libraries) - put them in the **vendor** folder and connect them in the **\_vendor.scss** file.
116+
117+
In the final folder **app/css** two files are created:
118+
- **main.css** - for page styles,
119+
- **vendor.css** - for styles of all libraries used in the project.
120+
121+
### 📁 Working with JavaScript
122+
123+
Webpack is used to build the JS code.
124+
125+
JS code is better divided into components - small js-files that contain their own, isolated from each other implementation. Place such files in the **components** folder, and then import them into the **\_components.js** file
126+
127+
The **main.js** file is the main file where all the others are connected.
128+
129+
### 📁 Working with fonts
130+
131+
The build implements support for **woff2** format only
132+
133+
Load the **woff2** files into the **assets/fonts** folder, and then call the `@font-face` mixin in the **\_fonts.scss** file.
134+
135+
Also, don't forget to put the same fonts in `<link preload>` in the html.
136+
137+
### 📁 Working with images
138+
139+
Put any images other than **favicon** in the **img** folder.
140+
141+
If you need to make an svg sprite, put the svg files needed for the sprite in the **img/svg** folder. At the same time, attributes like fill, stroke, style will be automatically removed. Other svg files just leave them in the **img** folder.
142+
143+
If you use the `gulp build` command, you will get minified images in the final **img** folder.
144+
145+
### 📁 Working with other assets
146+
147+
Any project assets that do not have a corresponding folder should be stored in the **resources** folder. These can be video files, php files (such as form submission file), favicon and others.
148+
149+
### 📁 Typographer
150+
151+
For the correct display of text on the page was connected plugin typographer, which will automatically add unbroken spaces and other characters, so that the text everywhere displayed according to all the rules of the language.
152+
153+
### 📁 Seo optimization
154+
155+
The main index.html lists a brief excerpt and descriptions of each meta tag
156+

gulp/config/paths.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const srcFolder = './src'
2+
const buildFolder = './app'
3+
4+
export const paths = {
5+
base: {
6+
src: srcFolder,
7+
build: buildFolder
8+
},
9+
srcSvg: `${srcFolder}/img/svg/**.svg`,
10+
srcImgFolder: `${srcFolder}/img`,
11+
buildImgFolder: `${buildFolder}/img`,
12+
srcScss: `${srcFolder}/styles/**/*.scss`,
13+
buildCssFolder: `${buildFolder}/css`,
14+
srcFullJs: `${srcFolder}/js/**/*.js`,
15+
srcMainJs: `${srcFolder}/js/main.js`,
16+
buildJsFolder: `${buildFolder}/js`,
17+
srcComponentsFolder: `${srcFolder}/components`,
18+
assetsFolder: `${srcFolder}/assets`
19+
}

gulp/tasks/cache.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import rev from 'gulp-rev'
2+
import revDel from 'gulp-rev-delete-original'
3+
4+
export const cacheTask = () => {
5+
return app.gulp
6+
.src(`${app.paths.base.build}/**/*.{css,js,svg,png,jpg,jpeg,webp,woff2}`, {
7+
base: app.paths.base.build,
8+
encoding: false
9+
})
10+
.pipe(rev())
11+
.pipe(revDel())
12+
.pipe(app.gulp.dest(app.paths.base.build))
13+
.pipe(rev.manifest('rev.json'))
14+
.pipe(app.gulp.dest(app.paths.base.build))
15+
}

gulp/tasks/clean.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { deleteAsync } from 'del'
2+
3+
export const clean = () => {
4+
return deleteAsync(app.paths.base.build)
5+
}

gulp/tasks/html-include.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import browserSync from 'browser-sync'
2+
import fileInclude from 'gulp-file-include'
3+
4+
export const htmlInclude = () => {
5+
return app.gulp
6+
.src([`${app.paths.base.src}/pages/*.html`])
7+
.pipe(
8+
fileInclude({
9+
prefix: '@',
10+
basepath: '@file',
11+
maxRecursion: 100
12+
})
13+
)
14+
.pipe(app.gulp.dest(app.paths.base.build))
15+
.pipe(browserSync.stream())
16+
}

0 commit comments

Comments
 (0)