open-index/open-npm huggingface dataset:
npm package: @shopify/slate-analytics
Description: Slate's analytics controller and event emitter
Author: Shopify Inc.
Latest version: 1.0.0-beta.16

[![npm version](https://badge.fury.io/js/%40shopify%2Fslate-analytics.svg)](https://badge.fury.io/js/%40shopify%2Fslate-analytics)

# @shopify/slate-analytics

Slate Analytics enables Shopify to track Slate user events, performance data, and errors to Shopify's analytics platform.

For more information, visit [the documentation website](https://shopify.github.io/slate/docs/slate-analytics).
npm package: @shopify/slate-config
Description: Generate configurations for Slate packages by applying values from slate.config.js to override default values
Author: Shopify Inc.
Latest version: 1.0.0-beta.14

# @shopify/slate-config

Handles all of Slate's configurable options. Slate packages can declare options in schema files and access the default values of these options in their code. Slate Config will also look for a `slate.config.js` file in the root of a Slate theme project and use any key/values declared in it to override default values declared in Slate packages.

### Example Schema

The format of Slate configurations relies on a flat object structure using unique keys to access each of its configuration items.

```js
const path = require('path');
const commonPaths = require('@shopify/slate-config/common/paths.schema');

module.exports = {
  // You can divide your config items across multiple files, import them, and then
  // spread them into your main config schema. Slate Config comes with common
  // config items like paths which might be used in any Slate package.
  ...commonPaths

  // Configuration values can be set directly
  'webpack.babel.enable': true,

  // Or computed when the schema file is require()'d by another file
  'paths.theme': process.cwd(),

  // Or even computed when requested by Slate Config's .get() method. This allows
  // configuration items to access other configuration items. The argument passed
  // to the function is an instance of the SlateConfig() class.
  'paths.theme.src': config => path.join(config.get('paths.theme'), 'src'),
};
```

### Methods

#### SlateConfig(schema)

The main class constructor which consumes a config schema and returns a config instance.

```
const SlateConfig = require('@shopify/slate-config');
const config = new SlateConfig(require('../../../slate-tools.schema'));
```

#### SlateConfig.prototype.get(key)

Fetches the value of a given config item, and throws an error if the item does not exist

```
const themeRoot = config.get('paths.theme');
```

#### SlateConfig.prototype.set(key, value, override)

Sets the value of config item, and throws an error in the key already has a value set to it, unless the override boolean is set to true.

```
config.set('newKey', 'newValue'); // Sets new key in your config instance
config.set('existingKey', 'someValue'); // Throws an error because key already exists
config.set('existingKey', 'newValue', true); // Doesn't throw an error because override is set to true
```

### Testing

Generally, it's considered a best practice to add unit tests to any configuration items you use in your code to catch any future unintentional regressions. To test a configuration item, you can modify the global object used to normally store `slate.config.js` values:

```
global.slateUserConfig['paths.theme'] = 'some/new/path/for/testing'
```
npm package: @shopify/slate-cssvar-loader
Description: Finds CSS custom properties (variables) in your stylesheets and replaces them with their corresponding liquid variable
Author: Shopify Inc.
Latest version: 1.0.0-beta.16

[![npm version](https://badge.fury.io/js/%40shopify%2Fslate-cssvar-loader.svg)](https://badge.fury.io/js/%40shopify%2Fslate-cssvar-loader)

# @shopify/slate-cssvar-loader

Finds CSS custom properties (variables) in your stylesheets and replaces them with their corresponding Liquid variable found in the provided `cssVariablesPath` option.

For more information, visit [the documentation website](https://shopify.github.io/slate/docs/slate-cssvar-loader).
npm package: @shopify/slate-liquid-asset-loader
Description: Parses liquid files, searching for assets that are piped to `asset_url` and transforming them into `require()` call so that images are run through the correct loader and their name are fingerprinted.
Author: Shopify Inc.
Latest version: 1.0.0-beta.11

# @shopify/slate-liquid-asset-loader

Parses liquid files, searching for assets that are piped to `asset_url` and transforming them into `require()` call so that images are run through the correct loader and their name are fingerprinted.
npm package: @shopify/slate-tag-webpack-plugin
Description: A webpack plugin that tags a Slate theme settings_schema.json so it's easy to identify on Shopify servers
Author: Shopify Inc.
Latest version: 1.0.0-beta.14

# @shopify/slate-tag-webpack-plugin

A webpack plugin that tags a Slate theme settings_schema.json so it's easy to identify on Shopify servers.
npm package: @shopify/slate-tools
Description: A modern development toolkit for Shopify themes
Author: Shopify
Latest version: 1.0.0-beta.19

[![npm version](https://badge.fury.io/js/%40shopify%2Fslate-tools.svg)](https://badge.fury.io/js/%40shopify%2Fslate-tools)

# @shopify/slate-tools

Slate Tools provides a sophisticated development experience enabling users to build top-notch Shopify themes.
npm package: @shopify/slate-translations
Description: This plugin allows you to separate the translations into individual locale files allowing for easier maintainability for your theme's merchant-facing translations.
Latest version: 1.0.0-beta.19

# @shopify/slate-translations

This plugin allows you to separate the translations into individual locale files allowing for easier maintainability for your theme's merchant-facing translations.

## Getting Started

First install the plugin

```
npm install @shopify/slate-translations --save-dev
```

or

```
yarn add @shopify/slate-translations --dev
```

## Translations

If you need settings in your schema (e.g. a section's schema or `config/settings_schema.json`) that requires multiple translations, you can specify this by doing the following:

```json
{
  "name": {
    "de": "Posts",
    "en": "Posts",
    "es": "Publicaciones",
    "fr": "Articles",
    "it": "Articoli",
    "ja": "投稿",
    "pt-BR": "posts"
  },
  "settings": [
    {
      "type": "checkbox",
      "id": "image_parallax",
      "label": {
        "de": "Parallax-Animation für Bild anzeigen",
        "en": "Show image parallax animation",
        "es": "Mostrar animación de paralaje de imagen",
        "fr": "Afficher l'animation en parallaxe",
        "it": "Mostra animazione parallasse immagine",
        "ja": "画像のパララックスアニメーションを表示する",
        "pt-BR": "Exibir animação de paralaxe da imagem"
      }
    }
  ]
}
```

However, as the number of theme languages add up over time, and when you have many settings that require translations, this can result in a very large JSON file which becomes difficult to maintain. You can avoid this by leveraging this plugin and following the steps below.

First you specify the schema's structure in `schema.json`:

```json
{
  "name": {
    "t": "name"
  },
  "settings": [
    {
      "type": "checkbox",
      "id": "image_parallax",
      "label": {
        "t": "settings.image_parallax.label"
      }
    }
  ]
}
```

For every key with multiple translations you specify an object with a `t` key and its value is the key to retrieve the translation from a different JSON object as the one shown below. You would have a translation object such as the one below for every language you would like to support:

```json
{
  "name": "Posts",
  "settings": {
    "image_parallax": {
      "label": "Show image parallax animation",
      "info": "Only shows on desktop"
    }
  }
}
```

The plugin will take care of combining all the translations into an object such as the one displayed initially. To specify the locale code of your JSON file, you must name it [`localecode`].json

Below is an example of what your section's folder may look like:

```json
./sections/header
├── locales
│   ├── de.json
│   ├── en.json
│   ├── es.json
│   ├── fr.json
│   ├── it.json
│   ├── ja.json
│   └── pt-BR.json
├── schema.json
└── template.liquid
```

This will all get combined and outputted into a single `header.liquid`.