2.1.1 • Published 1 year ago

@startinblox/component-boilerplate v2.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Solid Boilerplate

This is a ready-to-use base component, to quickly start new sib component projects with best practices in mind.

WARNING

This component is still a work-in-progress. Do not use things you find here as references for now.

Access core within your component

Use core variable directly, eg.:

import('./utils.js').then(utils => {
  import(utils.coreVersion()).then(core => {
    customElements.define("solid-boilerplate",
      class extends core.SolidTemplateElement {
        constructor() {
          core.store.put({
            'username': 'Superman',
            '@context': this.context,
          }, 'http://server/users/admin/');
        }
      }
    );
  });
});

Target a local asset

Use the utils.path() function to return the actual path of your component (local or cdn), eg.:

import('./utils.js').then(utils => {
  import(utils.coreVersion()).then(core => {
    customElements.define("solid-boilerplate",
      class extends core.SolidTemplateElement {
        constructor() {
          core.Helpers.importCSS(utils.path() + '/styles/index.css?min');
        }
      }
    );
  });
});