3.0.0 • Published 2 years ago

@larsroettig/component-targetables v3.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

PWAStudio .targetables.js Plugins

Codacy Badge Coverage Status

Allows to use .targetables.js for PWAStudio

Usage Exsample

const { ExtendLocalIntercept } = require('@larsroettig/component-targetables');

function localIntercept(targets) {
    const { Targetables } = require('@magento/pwa-buildpack');
    const targetables = Targetables.using(targets);

    const extendLocalIntercept = new ExtendLocalIntercept(targetables);
    extendLocalIntercept.allowCustomTargetables();
    extendLocalIntercept.allowCssOverwrites();
}

module.exports = localIntercept;

Big shoutout to Chris Brabender for this blog post https://dev.to/chrisbrabender/simplifying-targetables-in-pwa-studio-p8b

Api Documentation

allowCssOverwrites

allowCssOverwrites(targetablesSearchPaths?, fileExtendsion?, magentoPath?): void

Parameters

NameTypeDefault value
fileExtendsionstring'*.module.css'
targetablesSearchPathsstring[]['src/components', 'src/RootComponents']
magentoPathstring'node_modules/@magento'

Returns

void


allowCustomTargetables

allowCustomTargetables(targetablesSearchPaths?, fileExtendsion?, magentoPath?): void

Allows to place a custome targetable with given matching filepattern.

Parameters

NameTypeDefault value
fileExtendsionstring'*.targetables.js'
targetablesSearchPathsstring[]['src/components', 'src/RootComponents']
magentoPathstring'node_modules/@magento'

Returns

void

Demo

https://github.com/larsroettig/demo-component-targetables

3.0.0

2 years ago

2.1.2

2 years ago

3.0.0-rc7

2 years ago

3.0.0-rc6

2 years ago

3.0.0-rc5

2 years ago

3.0.0-rc4

2 years ago

2.1.0

2 years ago

3.0.0-rc3

2 years ago

2.0.0

3 years ago

1.0.0

3 years ago