Skip to main content

Project

Define patterns which are unique to the project which consists of several components and other elements.

Elements that make up contents for your project come under this layer, such as an article list, user profile, or image gallery.

Original FLOCLSS is defined the above, but it's hard to categorize in case of Web site project, there are many unique styles for each page, so we define Project as Define patterns which are unique layout for each page.

You must use .p- prefix for Project.

File naming rules​

Project is created for each page, so name the files after the URL.

  • Files: the slashes (/) of the URL become folders. A page with child pages uses _index.scss in its folder, and a page without child pages sits directly under object/project/.
  • Classes: the slashes (/) of the URL are replaced with hyphens (-).

The top page is "_index.scss".

Posts that share one template, such as news posts (http://example.com/news/xxx/), use _detail.scss in the folder of their archive.

Add each new file to style.scss.

@import "object/project/index";
@import "object/project/about";
@import "object/project/product/index";
@import "object/project/product/foo";

Example​

<div class="p-index">
<section class="p-index__section">
<h2 class="p-index__section__head">SECTION TITLE</h2>

<ul class="p-index__section__nav">
<li class="p-index__section__nav__item">
<a href="#" class="c-button p-index__section__nav__anchor">BUTTON</a>
</li>
</ul>
</section>
</div>
scss/object/project/_index.scss
.p-index {
&__section {
// something style

&__head {
// something style
}

&__nav {
// something style

&__item {
// something style
}

&__anchor {
// something style
}
}
}
}
TIPS

This Example Project has has Component (.c-button), but you must NOT overwrite styles of those inside of Project. Please make Child Project (.p-index__section__nav__anchor), then you can define the style of that element.

Reference : Don't include other component