### TARS-CLI Start Command Usage Examples
Source: https://github.com/tars/tars-cli/blob/master/docs/en/commands.md
Provides examples for using the `tars start` command to execute Gulp tasks, showing how to start a development task and pass additional flags like `--lr` or `--ie` to the underlying Gulp process.
```bash
# Starts dev task from gulpfile
tars start dev
# Starts dev task from gulpfile with --lr flag
tars start dev --flags '--lr'
# Starts dev task from gulpfile with --lr and --ie flags
tars start dev --flags '--lr --ie'
```
--------------------------------
### TARS-CLI Build Command Usage Examples
Source: https://github.com/tars/tars-cli/blob/master/docs/en/commands.md
Illustrates various ways to use the `tars build` command with different flags, demonstrating how to start interactive mode, run silently, minify files, or create release versions with IE support and custom flags.
```bash
# Will be start an interactive mode
tars build
# The command will be run without flags and interactive mode
tars build --silent
# Will be created a version of the build with minified files
tars build -m
# Will be created a release-version of the build + ie8 support
tars build --release --ie8
# Will be created a release-version of the build + ie8 and ie9 support + two custom flag
tars build --release --ie --custom-flags '--custom-flag1 --custom-flag2'
```
--------------------------------
### Example TARS Component Scheme File
Source: https://github.com/tars/tars-cli/blob/master/docs/en/component-scheme.md
A comprehensive example of a TARS component scheme file, demonstrating how to define folders and files with dynamic content using special variables like __componentName__, __templateExtension__, and __cssExtension__.
```js
{
"folders": [
{
"name": "data",
"files": [
{
"name": "data.js",
"content": "__componentName__: {}"
}
]
}
],
"files": [
{
"name": "__componentName__.__templateExtension__",
"content": "
"
}, {
"name": "__componentName__.__cssExtension__",
"content": ".__componentName__ {}"
}, {
"name": "__componentName__.js",
"content": ""
}
]
}
```
--------------------------------
### Install TARS-CLI globally
Source: https://github.com/tars/tars-cli/blob/master/README.md
Installs the TARS-CLI command-line interface globally using npm, making the 'tars' command available system-wide. This is the first step to using TARS-CLI.
```bash
npm i -g tars-cli
```
--------------------------------
### TARS-CLI Start Command Available Flags
Source: https://github.com/tars/tars-cli/blob/master/docs/en/commands.md
Documents the `--flags` option for the `tars start` command, which allows passing additional flags to the specified Gulp task. This command is useful for extending TARS-CLI functionality with custom Gulp tasks.
```APIDOC
--flags: allows you to use flags with %taskName%. An example of use is described below. Flags have to be separated by the space without quotes and commas in interactive mode.
```
--------------------------------
### Reinstall TARS-CLI after failed update
Source: https://github.com/tars/tars-cli/blob/master/docs/en/troubleshooting.md
If 'tars update' fails, especially due to permission issues (e.g., installing with superuser and updating without), reinstalling 'tars-cli' globally can resolve the problem. This ensures correct permissions are applied for future operations.
```bash
npm i -g tars-cli
# or, if it is needed
sudo npm i -g tars-cli
```
--------------------------------
### TARS-CLI Add Component Command Usage Examples
Source: https://github.com/tars/tars-cli/blob/master/docs/en/commands.md
Demonstrates various uses of the `tars add-component` command to create new components with different configurations, including interactive mode, basic files, assets, data, full structure, template-based, scheme-based, empty, and custom path options.
```bash
# Will be start an adding component interactive mode named "sidebar"
tars add-component sidebar
# Adds component "sidebar" with basic file and assets folder
tars add-component sidebar -b -a
# Adds component "sidebar" with the basic files, folders, assets and folders for data
tars add-component sidebar -b -a -d
# Adds component "sidebar" with all files and folders
tars add-component sidebar --full
# Adds component "sidebar" which is based on _template
tars add-component sidebar --template
# Adds in components empty folder named "sidebar"
tars add-component sidebar -e -b -a -d -i
# Adds component "sidebar" which structure is based on
# default_component_scheme.json
tars add-component sidebar -s
# Adds component "sidebar" into example-component directory
```
--------------------------------
### TARS CLI Example: Copy and Rename File Actions
Source: https://github.com/tars/tars-cli/blob/master/docs/en/custom-update-actions.md
This example illustrates the 'copy' and 'rename' actions. The 'copy' action transfers `_template.html` from the new version to the current project. The 'rename' action then renames `_template.html` to `_index.html` within the current project. Paths are relative.
```js
{
"copy": [
{
"from": "/markup/pages/_template.html",
"to": "/markup/pages/_template.html"
}
],
"rename": [
{
"from": "/markup/pages/_template.html",
"to": "/markup/pages/_index.html"
}
]
}
```
--------------------------------
### Update TARS-CLI Globally to Fix pty.js Errors
Source: https://github.com/tars/tars-cli/blob/master/docs/en/troubleshooting.md
This command demonstrates how to update TARS-CLI globally using npm. It is the recommended solution for resolving installation errors related to the `pty.js` module. Users experiencing permission issues should prepend `sudo` to the command.
```bash
npm update -g tars-cli
```
--------------------------------
### Display TARS-CLI command-specific help
Source: https://github.com/tars/tars-cli/blob/master/README.md
Provides detailed documentation and flag options for a specific TARS-CLI command. Append '--help' or '-h' to any command to get its full description.
```bash
tars --help
```
--------------------------------
### Display TARS-CLI and project TARS versions
Source: https://github.com/tars/tars-cli/blob/master/README.md
Shows the installed version of TARS-CLI and the version of TARS used in the current project. It also informs the user if an update for TARS-CLI is available.
```bash
tars --version
```
--------------------------------
### TARS CLI Example: Remove Folder Action
Source: https://github.com/tars/tars-cli/blob/master/docs/en/custom-update-actions.md
This example demonstrates how to use the 'remove' action within the `custom-update-actions.json` file to delete a specific folder, such as `/markup/pages`, from the current project during an update. The path specified is relative to the project root.
```js
{
"remove": [
"/markup/pages"
]
}
```
--------------------------------
### Run TARS development server with tars dev
Source: https://github.com/tars/tars-cli/blob/master/docs/en/commands.md
The `tars dev` command starts the TARS development server with watchers, executing the `gulp dev` task. It offers an interactive mode for selecting additional options, or can be run silently with flags to enable features like Livereload, create a tunnel for external access, or include styles for specific IE versions.
```bash
# Will be start an interactive mode
tars dev
```
```bash
# The command will be run without flags and interactive mode
tars dev --silent
```
```bash
# Will be start the server for livereload
tars dev -l
```
```bash
# Will be start the server for livereload and create a tunnel to the outside Web + ie8 support
tars dev --tunnel --ie8
```
```bash
# Will be start the server for livereload and creates a tunnel to the outside web ie8 and ie9 + two custom flag support
tars dev --tunnel --ie --custom-flags '--custom-flag1 --custom-flag2'
```
--------------------------------
### Update TARS-CLI Service Tasks for Older TARS Versions
Source: https://github.com/tars/tars-cli/blob/master/docs/en/troubleshooting.md
This snippet provides updated JavaScript code for `tars/tasks/services/clean.js` and `tars/tasks/services/remove-init-fs.js`. These updates are necessary to resolve build process issues, specifically when using TARS-CLI with TARS versions 1.3.1 and below, where the build might stall after the `service:clean` task. The code defines paths to be deleted during clean-up operations.
```javascript
// clean.js
'use strict';
var gulp = tars.packages.gulp;
var del = tars.packages.del;
tars.packages.promisePolyfill.polyfill();
var pathsToDel = [
'./dev/',
'./.tmpTemplater/',
'./.tmpPreproc/'
];
if (!tars.config.useBuildVersioning) {
pathsToDel.push(tars.options.build.path);
}
/**
* Clean dev directory and cache
*/
module.exports = function () {
return gulp.task('service:clean', function (cb) {
del(pathsToDel).then(function () { cb(); });
});
};
// remove-init-fs.js
'use strict';
var gulp = tars.packages.gulp;
var del = tars.packages.del;
var staticFolderName = tars.config.fs.staticFolderName;
tars.packages.promisePolyfill.polyfill();
var pathsToDel = [
'markup/' + staticFolderName + '/js/framework',
'markup/' + staticFolderName + '/js/libraries',
'markup/' + staticFolderName + '/js/plugins',
'markup/' + staticFolderName + '/' + tars.config.fs.imagesFolderName + '/',
'markup/' + staticFolderName + '/fonts/',
'markup/' + staticFolderName + '/scss/',
'markup/' + staticFolderName + '/stylus/',
'markup/' + staticFolderName + '/less/',
'markup/modules/_template/assets/',
'markup/modules/_template/ie/',
'./markup/modules/head/',
'./markup/modules/footer/',
'./markup/modules/_template/_template.scss',
'./markup/modules/_template/_template.less',
'./markup/modules/_template/_template.styl',
'./markup/modules/_template/_template.html',
'./markup/modules/_template/_template.jade',
'./markup/pages/',
'./.tmpTemplater/',
'./.tmpPreproc/'
];
/**
* Remove inited file structure.
*/
module.exports = function () {
return gulp.task('service:remove-init-fs', function (cb) {
del(pathsToDel).then(function () { cb(); });
});
};
```
--------------------------------
### Initialize a new TARS project
Source: https://github.com/tars/tars-cli/blob/master/README.md
Initializes a new TARS project in the current directory. This command sets up the basic project structure and dependencies required for TARS development.
```bash
tars init
```
--------------------------------
### Display TARS-CLI general help
Source: https://github.com/tars/tars-cli/blob/master/README.md
Shows a comprehensive list of all available TARS-CLI commands and their flags. This command can be invoked with '--help', '-h', or by simply running 'tars' without any arguments.
```bash
tars --help
```
--------------------------------
### Initialize TARS project with tars init
Source: https://github.com/tars/tars-cli/blob/master/docs/en/commands.md
The `tars init` command initializes a new TARS project in the current directory by fetching files from the original TARS repository. It supports an interactive mode for project configuration (template, preprocessor, etc.) and various flags to control the initialization process, such as silent mode or specifying a custom source.
```bash
# Starts init in interactive mode
tars init
```
```bash
# Starts init without interactive mode
tars init --silent
```
```bash
# Downloads TARS from http://url.to.tars.zip and inits project in interactive mode
tars init -s http://url.to.tars.zip
```
```bash
# Downloads TARS from http://url.to.tars.zip and inits project without interactive mode
tars init --silent --source http://url.to.tars.zip
```
```bash
# Downloads TARS from http://url.to.tars.zip and inits project in interactive mode without templater-files updating
tars init --exclude-html -s http://url.to.tars.zip
```
--------------------------------
### TARS-CLI Build Command Available Flags
Source: https://github.com/tars/tars-cli/blob/master/docs/en/commands.md
Documents the command-line flags for the `tars build` command, explaining their function for static file minimization, release preparation, IE support, silent operation, and custom flag integration.
```APIDOC
-m, --min: minimizes static files.
-r, --release: minimizes static files and adds hash to file-names. This mode is useful if you need build, that is ready for deploy.
--ie8: includes styles for ie8 in the build.
--ie9: includes styles for ie9 in the build.
--ie: includes styles for ie8 and ie9 in the build.
--silent: starts builder without interactive mode.
--custom-flags: allows you to use custom flags with dev-command. An example of use is described below. Flags have to be separated by the space without quotes and commas in interactive mode.
```
--------------------------------
### Add Component to TARS Project (tars add-component)
Source: https://github.com/tars/tars-cli/blob/master/docs/en/commands.md
This command adds a new component to your TARS project. It demonstrates how to use a custom scheme and specify a custom path for the new component.
```APIDOC
tars add-component %componentName%
Description: Adds a new component to the project. The structure is based on custom_scheme.json.
Flags:
-s, --scheme: Specifies a custom scheme for the component.
--custom-path: Specifies a custom path for the component.
```
```bash
tars add-component sidebar -s custom_scheme --custom-path example
```
--------------------------------
### Add New Page to TARS Project (tars add-page)
Source: https://github.com/tars/tars-cli/blob/master/docs/en/commands.md
This command adds a new page to the markup/pages directory. It takes the page name as a parameter and supports creating empty pages or pages based on a template, handling different file extensions.
```APIDOC
tars add-page %pageName%
Description: Adds a new page in the markup/pages. Takes the name of the page as a parameter. An error will be thrown if the page already exists. It is possible to add an empty page or a copy of the template page. If pageName includes an extension, the new page will be created from _template with the same extension; otherwise, the default extension for the current templater (.jade for Jade, .html for Handlebars) will be used.
Flags:
-e, --empty: Adds an empty page.
```
```bash
# Will be created an inner page.{Html, jade} based _template.{Html, jade}
tars add-page inner
```
```bash
# Will be created an inner.html page based on _template.html
tars add-page inner.html
```
```bash
# Will be created an empty inner.html page
tars add-page inner -e
```
--------------------------------
### TARS-CLI Add Component Command Available Flags and Data Structure
Source: https://github.com/tars/tars-cli/blob/master/docs/en/commands.md
Documents the various flags for the `tars add-component` command, controlling the structure and content of new components. It also includes the default JavaScript object structure created when using the `--data` flag.
```APIDOC
-f, --full: adds component with all folders and files that can be in the component: folder for the assets, ie, data + selected templater file, js and selected css-preprocessor.
-b, --basic: adds only basic files.
-d, --data: adds a folder for data. It also creates a data-file with the following contents:
-i, --ie: adds a folder for the styles for IE.
-a, --assets: adds a folder for assets.
-t, --template: creates new component, which is based on component _template. So, if you need your own template for all new components, you can use this flag. **Attention, it is very important, that _template has to be existed in markup/components!** After using flag -t new component this name %componentName% will be created and it will be a full copy of _template component. So, you have to rename all files and folders in new component by yourself in that case, cause TARS doesn't know anything about structure of _template component.
-s, --scheme: adds a new component which structure is based on scheme file. By default it is default_component_scheme in components folder in your project. You can get more info about scheme from [docs](component-scheme.md).
--custom-path: this option allows to set custom path for new component. This option is usefull in case of creating inserted component.
-e, --empty: adds just component folder without files.
```
```javascript
componentName: {
}
```
--------------------------------
### TARS CLI Custom Update Actions JSON Structure
Source: https://github.com/tars/tars-cli/blob/master/docs/en/custom-update-actions.md
This JSON structure outlines the configuration for custom update actions in TARS CLI. It includes arrays for 'remove' (files/folders to delete), 'copy' (source and destination paths for copying), and 'rename' (old and new paths for renaming). All paths must be relative.
```js
{
"remove": [
"path to file or folder to remove",
...
],
"copy": [
{
"from": "path to file or folder to copy from",
"to": "path to file or folder to copy to"
},
...
],
"rename": [
{
"from": "path to file or folder to rename",
"to": "path to file or folder with new name"
},
...
]
}
```
--------------------------------
### TARS Component Scheme File Object Structure
Source: https://github.com/tars/tars-cli/blob/master/docs/en/component-scheme.md
Outlines the structure of a file object within a TARS component scheme, specifying its name and content. The content can include special variables for dynamic replacement.
```js
{
"name": "sidebar", // File name
"content": ""
}
```
--------------------------------
### Update npm to latest version
Source: https://github.com/tars/tars-cli/blob/master/README.md
Updates the npm package manager to its latest global version. This is particularly important for users on Node.js version 5.x.x to ensure compatibility with TARS-CLI.
```bash
npm i -g npm
```
--------------------------------
### TARS Component Scheme File Top-Level Structure
Source: https://github.com/tars/tars-cli/blob/master/docs/en/component-scheme.md
Defines the root structure of a TARS component scheme file, specifying arrays for folders and files that reside at the component's base level.
```js
{
"folders": [] // Array of objects, which discribe every folder in current folder
"files": [] // Array of objects, which discribe every file in current folder
}
```
--------------------------------
### Update TARS-CLI Version (tars update)
Source: https://github.com/tars/tars-cli/blob/master/docs/en/commands.md
This command updates the TARS-CLI to its latest available version by running 'npm update -g tars-cli'. It includes a note on using sudo and a troubleshooting step for clearing the npm cache if the update doesn't take effect.
```APIDOC
tars update
Description: Updates the current version of TARS-CLI to the latest available. Internally executes 'npm update -g tars-cli'. If installed with sudo, sudo may be required again. If the version remains unchanged, clearing the NPM cache is recommended.
```
```bash
npm cache clean
```
```bash
tars update
```
--------------------------------
### TARS Component Scheme Folder Object Structure
Source: https://github.com/tars/tars-cli/blob/master/docs/en/component-scheme.md
Describes the structure of a folder object within a TARS component scheme, including its name and arrays for nested files and folders. This structure is recursive.
```js
{
"name": "data", // Folder name
"files": [] // Array of objects, which discribe every file in current
"folders": [] // Array of objects, which discribe every folder in current
}
```
--------------------------------
### Update TARS Project Version (tars update-project)
Source: https://github.com/tars/tars-cli/blob/master/docs/en/commands.md
This command updates the TARS version within the current project. It offers flags to force the update, specify a custom source, and exclude certain files like HTML templates or CSS sprite templates from being updated.
```APIDOC
tars update-project
Description: Updates the current version of TARS in the current project to the latest available. Ensure you are using the latest TARS-CLI version before updating.
Flags:
-f, --force: Forces the update even if the current project version is already the latest.
-s, --source: Allows updating the project from any TARS archive (e.g., a URL).
--exclude-html: Prevents _template.{html,hbs,jade} from being updated.
--exclude-css: Prevents sprite-templates from being updated.
```
```bash
# Starts update-project
tars update-project
```
```bash
# Starts update-project without preprocessor-files updating
tars update-project --exclude-css
```
```bash
# Downloads TARS from http://url.to.tars.zip and update current project
tars update-project -s http://url.to.tars.zip
```
```bash
# Downloads TARS from http://url.to.tars.zip and update current project without templater-files updating
tars update-project --exclude-html -s http://url.to.tars.zip
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.