This repository has been archived by the owner on Sep 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 680
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
some cleanups and touches to the readmes
- Loading branch information
benjtinsley
committed
Oct 3, 2017
1 parent
ed26fe6
commit 885b79b
Showing
15 changed files
with
98 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{% extends 'layouts/application' %} | ||
{{ macros.css('example-component') }} | ||
|
||
<div class="example-component"> | ||
<p>{{ text }}</p> | ||
<p><strong>{{ caveat }}</strong></p> | ||
<p><a href="#TODO">{{ link }}</a></p> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// es6-promise/auto needed to fulfil promises for the `import()` statement in modules/index.js | ||
require('es6-promise/auto') | ||
import './modules' | ||
|
||
console.log(`app.js has loaded!`) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default class Example { | ||
constructor(el) { | ||
this.el = el | ||
console.log(el.textContent, '- From the example module') | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
Automatically instantiates modules based on data-attributes | ||
specifying module file-names. | ||
*/ | ||
|
||
const moduleElements = document.querySelectorAll('[data-module]') | ||
|
||
for (var i = 0; i < moduleElements.length; i++) { | ||
const el = moduleElements[i] | ||
const name = el.getAttribute('data-module') | ||
|
||
import(`./${name}`).then(Module => { | ||
new Module.default(el) | ||
}); | ||
} | ||
|
||
/* | ||
Usage: | ||
====== | ||
html | ||
---- | ||
<button data-module="disappear">disappear!</button> | ||
js | ||
-- | ||
// modules/disappear.js | ||
export default class Disappear { | ||
constructor(el) { | ||
el.style.display = 'none' | ||
} | ||
} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# HTTP2 component styles | ||
|
||
Each HTML component you create should have a corresponding CSS directory within components. | ||
|
||
Every component should import the config files (variables, mixins and functions) so that anything defined there can be used to calculate values within the component. | ||
|
||
## Organizing your stylesheets directory | ||
Standard component directory structure should include an index file that imports the config files as well as any files in the directory, usually just one that is either named `_base.scss` or `_[component-name].scss` for easier fuzzy finder location. | ||
|
||
For example: | ||
|
||
``` | ||
/components | ||
| | ||
/example-component | ||
| | | ||
| index.scss // imports config and any underscored files in this directory | ||
| _example-component.scss // has all the styles for this component | ||
| | ||
/another-component | ||
| | ||
index.scss | ||
// etc | ||
``` | ||
|
||
## Using component styles in your HTML templates | ||
Using the `css()` macro defined in `src/html/macros/helpers.html` will allow you to easily pull in the styles defined for that component inline. To use simply call `{{ macros.css('example-component') }}` before writing any HTML in the template and it will find pull in the index file of that directory. |
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters