Please note: The CLI is intended to be used with bash or zsh. In order for scss-lint to work, you need to have ruby installed on your machine.
Move the 'sgc-core' folder inside your project root and execute the install script.
If you don't want to install the sgc command globally (e.g. in a server environment), just pass the --local flag to the install script.
If you want to install the SGC on a Windows machine, there are some additional preparations are required:
To configure the frontend build process to your needs, you will have to modify the .sgc-config.json that the installer will put into your projects root-directory.
Heads up Prior to SGC 1.2.0, the config file was named config.json and lived inside the sgc-core/gulp folder. If this file is still present, sgc will use it instead of the .sgc-config.json. It is highly advised to use .sgc-config.json instead!
Configuration for the critical path css.
A list of extensions that should be included in the watch task. Please note, that the very first extension in this list is expected to be your project_theme.
BrowserSync is a neat tool that will help you during the development and testing process. When you run
sgc, it will spin
inside an extension that is on your watch list (see the option above), BrowserSync will automatically reload the page
or inject your changes directly into the browser. You can also open several instances of the BrowserSync URL in different
browser windows and BS will take care of synchronizing all input and scroll events between them.
You can run a specific task on a specific component, or start a watcher that will fire up BrowserSync and run tasks when source files change. Extensions that will be watched are defined in your .sgc-config.json file for each project.
If you run a specific task, you need to specify the extension you want the task to run on with the --ext parameter.
sgc css --ext project_base
There are a few available tasks you need to remember:
Hint: If you already have a browsersync instance open in your browser, you can pass the argument -s to restart the session without opening a browser.
sgc css:sprites --ext [extension name]
Triggers sprite generation inside the given directory.
This task will generate a png inside the images folder, containing all the sprites and a .scss file inside the sass folder, which will provide the necessary mixins. To use the sprites inside your SASS code, import the _sprite.scss file. You can then use the following mixins:
// will output css for a sprite image 'box.png'.element
The @sprite mixin already contains width and height. If you need these values for something else, use the @sprite-width and @sprite-height functions.
sgc css:svg --ext [extension name]
Triggers the generation of Sass-mixins for all SVGs inside the given directory. Each mixin will enable the usage of the associated SVG as a css background image.
; // imports the file with the generated mixins (inside your Sass-root).icon-globe
This task will read the html file you specified as abovethefold.template, read every statement in it and replace it with the css styles the referenced file contains, as an inline style tag. To make use of this feature, you should create a separate css file in your project (abovethefold.scss -> abovethefold.css), as well as an html-template file that references this stylesheet (note that the path needs to be relative to the template file). You can then set this template file as your PageRenderTemplate. All styles inside your abovethefold.css file will now be inlined directly into the HTML of your website. Note that you should think about what to put in this file only styles that should be available directly after the render process on every page should go there.
sgc css --ext [extension name]
Triggers css compilation inside the given directory. Note, that this task will also run the sprite task before it starts.
sgc images --ext [extension name]
Optimizes all images for the given path.
This tasks optimizes all images (png, jpg, gif, svg) inside the folders you specified in the sgc-config.json file. You might want to run this task on a regular basis to compress user uploaded media.
You can easily extend the sgc functionality by writing your own modules. Simply create a sgc-scripts folder next to sgc-core and put your custom scripts in there. Right now only shell-scripts with are supported, other languages might follow in the future.
Execute your custom scripts by calling sgc
+ sgc-core+ sgc-scripts- updateInstance.sh- updateDeployData.sh
Please try to remove the npm-shrinkgwrap.json file and execute the following commands:
cd sgc-corerm -rf node_modulesnpm set registrynpm install