Support BlockName config - allows to rename the block.
This commit is contained in:
@@ -26,7 +26,7 @@ You will find all the block files in `/src` folder.
|
|||||||
/src/styles/
|
/src/styles/
|
||||||
*.scss
|
*.scss
|
||||||
|
|
||||||
/src/template.hbs
|
/src/*.template.hbs
|
||||||
```
|
```
|
||||||
|
|
||||||
# Block rules
|
# Block rules
|
||||||
@@ -51,7 +51,12 @@ how the data is stored. Don't change or edit these files - use the data as it is
|
|||||||
There are multiple data sources since the block can be reused in different situations with different data. We have to
|
There are multiple data sources since the block can be reused in different situations with different data. We have to
|
||||||
make sure that the block is always rendered properly.
|
make sure that the block is always rendered properly.
|
||||||
|
|
||||||
## Class Naming Convention
|
### Static Media Files
|
||||||
|
|
||||||
|
Use the `/src/images` folder in case you need to upload images or video files to the template. These files will be
|
||||||
|
available by the next URL: http://localhost:3000/images/${filename}
|
||||||
|
|
||||||
|
### Class Naming Convention
|
||||||
|
|
||||||
Use BEM naming system for class names: http://getbem.com/naming/
|
Use BEM naming system for class names: http://getbem.com/naming/
|
||||||
|
|
||||||
@@ -90,7 +95,26 @@ The lib is included in the project and ready for use. Test with `window.Swiper`
|
|||||||
|
|
||||||
## Development Toolbar
|
## Development Toolbar
|
||||||
|
|
||||||
Use development toolbar to switch between data sources and test responsiveness of block.
|
Use development toolbar to switch between data sources.
|
||||||
|
|
||||||
|
## Responsiveness
|
||||||
|
|
||||||
|
Make sure the layout is rendered correctly on all standard breakpoint size:
|
||||||
|
|
||||||
|
1. 1920px in width...
|
||||||
|
2. 1680px
|
||||||
|
3. 1440px
|
||||||
|
4. 1360px
|
||||||
|
5. 1280px
|
||||||
|
6. 1024px
|
||||||
|
7. 980px
|
||||||
|
8. 768px
|
||||||
|
9. 600px
|
||||||
|
10. 414px
|
||||||
|
11. 375px
|
||||||
|
|
||||||
|
If you follow the rules of REM unit - your layout must be "elastic" and most of the breakpoints should be rendered
|
||||||
|
properly.
|
||||||
|
|
||||||
## Pixel Perfect Test
|
## Pixel Perfect Test
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
"mode": "production",
|
cssUrl: "https://",
|
||||||
"cssUrl": "https://",
|
blockName: "template",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
"mode": "development",
|
mode: "development",
|
||||||
"cssUrl": "https://",
|
cssUrl: "https://",
|
||||||
|
blockName: "template",
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
<main>
|
<main>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{{> src/template }}
|
{{> (include_block_template) }}
|
||||||
</div>
|
</div>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@
|
|||||||
{{> (include_partial "layouts/partials/toolbar") }}
|
{{> (include_partial "layouts/partials/toolbar") }}
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
{{> src/template }}
|
{{> (include_block_template) }}
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
{{> (include_partial "layouts/partials/scripts") }}
|
{{> (include_partial "layouts/partials/scripts") }}
|
||||||
|
|||||||
@@ -4,6 +4,6 @@
|
|||||||
|
|
||||||
<link rel="stylesheet" href="{{ config.cssUrl }}">
|
<link rel="stylesheet" href="{{ config.cssUrl }}">
|
||||||
<link rel="stylesheet" href="styles/page--main.css">
|
<link rel="stylesheet" href="styles/page--main.css">
|
||||||
<link rel="stylesheet" href="styles/template.min.css">
|
<link rel="stylesheet" href="styles/{{ config.blockName }}.min.css">
|
||||||
<link rel="stylesheet" href="https://unpkg.com/swiper@8/swiper-bundle.min.css"/>
|
<link rel="stylesheet" href="https://unpkg.com/swiper@8/swiper-bundle.min.css"/>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>
|
<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>
|
||||||
<script src="https://unpkg.com/swiper@8/swiper-bundle.min.js"></script>
|
<script src="https://unpkg.com/swiper@8/swiper-bundle.min.js"></script>
|
||||||
<script src="scripts/page--toolbar.js"></script>
|
<script src="scripts/page--toolbar.js"></script>
|
||||||
<script src="scripts/template.min.js"></script>
|
<script src="scripts/{{ config.blockName }}.min.js"></script>
|
||||||
@@ -58,12 +58,14 @@ app.get('/', async (req, res) => {
|
|||||||
active: jsonFileName === name,
|
active: jsonFileName === name,
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
cssUrl: config.get('cssUrl')
|
cssUrl: config.get('cssUrl'),
|
||||||
|
blockName: config.get('blockName')
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
data.helpers = {
|
data.helpers = {
|
||||||
include_partial: (path) => projectDir + path,
|
include_partial: (path) => projectDir + path,
|
||||||
|
include_block_template: (path) => 'src/' + config.get('blockName') + '.template',
|
||||||
}
|
}
|
||||||
|
|
||||||
res.render('page-container', data);
|
res.render('page-container', data);
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
<section class="template">
|
|
||||||
<header class="template__header">
|
|
||||||
<h1 class="template__header-heading">Ready!</h1>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<div class="template__content">
|
|
||||||
<p>
|
|
||||||
Review the `/data` folder with JSON data files.<br>
|
|
||||||
Don't change data JSON files - use the data as it is.
|
|
||||||
</p>
|
|
||||||
<p>Build the layout based on provided data structure.</p>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
<section class="template">
|
||||||
|
|
||||||
|
{{!
|
||||||
|
Remove Everything Below:
|
||||||
|
}}
|
||||||
|
|
||||||
|
<style>
|
||||||
|
code {
|
||||||
|
background-color: #eee;
|
||||||
|
color: #333;
|
||||||
|
padding: 1rem 1.5rem;
|
||||||
|
border: 2px solid #d8d8d8;
|
||||||
|
display: inline-block;
|
||||||
|
border-radius: 2px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<header class="template__header">
|
||||||
|
<h1 class="template__header-heading">Ready!</h1>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<div class="template__content">
|
||||||
|
<p>
|
||||||
|
Review the `/data` folder with JSON data files.<br>
|
||||||
|
Don't change data JSON files - use the data as it is.
|
||||||
|
</p>
|
||||||
|
<p>Build the layout based on provided data structure.</p>
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<h2>Image Example</h2>
|
||||||
|
<div>
|
||||||
|
<img src="images/demo.jpeg" alt="">
|
||||||
|
<br>
|
||||||
|
<code>
|
||||||
|
<img src="images/demo.jpeg" alt="">
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br><br>
|
||||||
|
<hr>
|
||||||
|
|
||||||
|
<h2>Available Buttons Styling</h2>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<a href="#" class="btn btn--primary">Primary</a>
|
||||||
|
<br>
|
||||||
|
<code>
|
||||||
|
<a href="#" class="btn btn--primary">Primary</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<a href="#" class="btn btn--secondary">Secondary</a>
|
||||||
|
<br>
|
||||||
|
<code>
|
||||||
|
<a href="#" class="btn btn--secondary">Secondary</a>
|
||||||
|
</code>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{!
|
||||||
|
Remove END
|
||||||
|
}}
|
||||||
|
|
||||||
|
</section>
|
||||||
Reference in New Issue
Block a user