npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@squarespace/toolbelt

v0.12.5

Published

Utilities for building and maintaining Squarespace templates

Downloads

141

Readme

Squarespace Toolbelt

Utilities for building and maintaining Squarespace templates

Installation

npm install --save-dev @squarespace/toolbelt

Usage

In your package.json you can use Squarespace Toolbelt to automatically run build tasks on Squarespace templates. Example:

{
  "name": "your-squarespace-template",
  "version": "0.0.1",
  "devDependencies": {
    "@squarespace/toolbelt": "^0.1.0",
    "webpack": "^1.12.9"
  },
  "scripts": {
    "build":  "squarespace assemble && webpack",
    "watch":  "squarespace assemble -wT & webpack --watch",
    "server": "squarespace runserver -T",
    "start":  "squarespace setup && (npm run watch & npm run server)",
    "deploy": "squarespace setup && squarespace deploy"
  }
  ...
}

Above we include @squarespace/toolbelt in the devDependencies, and then use squarespace assemble in the project's build and watch scripts.

Automatic Reloading

The assemble command is designed to work with Squarespace Development Server's --trigger-reload option to automatically refresh the browser each time a change is detected. To take advantage of this, run assemble with the -T or --trigger-reload and -w or --watch flags like so:

squarespace assemble -wT

This will watch your build folder, automatically assembling each time a file changes, and triggering the dev server to reload.

You must also run the dev server with -T or --trigger-reload to listen for the triggers:

squarespace runserver -T

For more info see the reference below.

Reference

Squarespace Toolbelt exposes several scripts you can use in your template's package.json:

squarespace [options] [command]

Commands:

clean                cleans the build directory
assemble             assembles Squarepace template files into the build directory
deploy [repository]  deploys a Squarepace template
runserver            runs the Squarespace Development Server. (Must be installed separately. See http://developers.squarespace.com/local-development.)
setup                configures a Squarepace template for local development
help [cmd]           display help for [cmd]

Options:

-h, --help     output usage information
-V, --version  output the version number

squarespace setup [options]

Options:

-h, --help                   output usage information
-d, --directory <directory>  Directory to setup. Default is the current one.

squarespace assemble [options]

Options:

-h, --help                        output usage information
-n, --noclean                     Assemble without first cleaning the output directory.
-w, --watch                       Watch for changes and assemble incrementally.
-d, --directory <directory>       Source directory. Default is '.'
-o, --output <output>             Output directory for assembled files. Default is 'build'
-T, --trigger-reload [host:port]  Trigger Local Development Server to reload on each assemble.
-l, --legacy                      Copies scripts directory for older templates with squarespace:script tags.
-a, --after <command>             Run a command after the build has completed.

Using --trigger-reload:

Trigger reload takes an optional [host:post] that defaults to "localhost:9000". You can also provide a full domain with protocol, such as "https://192.168.10.10:3000". Typically all that's needed to watch your template files and trigger the Local Development Server is:

squarespace assemble -wT

squarespace clean [options]

Options:

-h, --help                   output usage information
-d, --directory <directory>  Directory to clean. Default is 'build'

squarespace deploy [options] [repository]

Options:

-h, --help                   output usage information
-d, --directory <directory>  Deploy from this directory. Default is 'build'
-m, --message <message>      Deployment message. Default is 'sqs-deploy <date time>'
-w, --watch                  Watch the build directory for changes and deploy automatically.
-f, --force                  Force deployment of build. This will overwrite any git history in your site's /template.git repository.
-a, --after <command>        Run a command after the build has completed.

Troubleshooting

If you are attempting to deploy a template other than the one cloned from your site's /template.git repository, you will encounter the following error:

fatal: refusing to merge unrelated histories

To solve this, you can use squarespace deploy --force. Beware that this will overwrite any git history in your site's /template.git repository.

squarepace runserver URL [options]

Runs Squarespace Local Development Server.

Requires @squarespace/server to be installed globally.

Options:

-h --help                           output usage information
-d --directory=PATH                 Path to cloned template repository [default ./build].
-p --port=PORT                      Port that server listens on [default 9000].
-T --trigger-reload                 Listen for reload trigger and refresh page.
--host=HOST                         Host that server listens on [default localhost].
--auth                              Log in to work on trial or password protected sites.

For full squarespace server options, see squarespace runserver --help.

Contributing

We are currently not accepting contributions to Squarespace Toolbelt.

Copyright and License

Copyright 2016 Squarespace, INC.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.