Implementation of the CSS Preprocessor command line tool. More...
#include <csspp/assembler.h>
#include <csspp/compiler.h>
#include <csspp/exception.h>
#include <csspp/parser.h>
#include <advgetopt/advgetopt.h>
#include <advgetopt/exception.h>
#include <boost/preprocessor/stringize.hpp>
#include <cstdlib>
#include <fstream>
#include <iostream>
#include <unistd.h>
#include <snapdev/poison.h>
Go to the source code of this file.
Classes | |
class | anonymous_namespace{csspp.cpp}::pp |
Namespaces | |
anonymous_namespace{csspp.cpp} | |
Functions | |
void | anonymous_namespace{csspp.cpp}::free_char (char *ptr) |
int | main (int argc, char *argv[]) |
Variables | |
constexpr advgetopt::option | anonymous_namespace{csspp.cpp}::g_options [] |
advgetopt::options_environment const | anonymous_namespace{csspp.cpp}::g_options_environment |
This tool can be used as a verification, compilation, and compression tool depending on your needs.
The Snap! Websites environment uses the tool for verification when generating a layout. Later a Snap! Website plugin compresses the various files. That way the website system includes the original file and not just the minimized version.
The following are the options currently supported by csspp:
The SCSS scripts expect some variables to be set. Some of these variables can be set on the command line with the –args option. The arguments are added to an array that can be accessed as the variable $_csspp_args.
At this time there is no other way to access command line arguments.
There is no $_csspp_args[0] since arrays in SCSS start at 1. This also means you do not (yet) have access to the name of the program compiling the code.
Multiple arguments can be specified one after another:
When specified, the error output is setup to output everything, including fatal errors, errors, warnings, informational messages, and debug messages.
The –help command line option can be used to request that the csspp print out the complete list of supported command line options in stdout.
The tool then quits immediately.
Specify paths to user defined directories that include SCSS scripts one can include using the @import command.
By default the system looks for system defined scripts (i.e. the default validation, version, and other similar scripts) under the following directory:
The system scripts (initialization, closure, version) appear under a sub-directory named "system".
The validation scripts (field names, pseudo names, etc.) appear under a sub-directory named "validation".
There are no specific rules for where include files will be found. The @import can use a full path or a local path. When a local path is used, then all the specified -I paths are prepended until a file matches. The first match is used.
You may specify any number of include paths one after another. You must specify -I only once:
This option prevents the "logo" comment from being added at the end of the output.
This option may be used to specify a filename used to save the output of the compiler. By default the output is written to stdout.
You may explicitly use '-' to write the output to stdout.
The output is written as consice as possible. Only that can cause problems with decimal numbers getting written with less precision than you need.
By default decimal numbers are written with 3 decimal numbers after the decimal point. You may use the –precision command line option to change that default to another value.
Note that numbers such as 3.5 are not written with ending zeroes (i.e. 3.50000) even if you increase precision.
By default csspp prints out all messages except debug messages.
This option also turns off informational and warning messages. So in effect all that's left are error and fatal error messages.
Note that if you used the –Werror command line options, warning are transformed to errors and thus they get printed in your output anyway.
By default the csspp compiler is expected to compress your CSS data as much as possible (i.e. it removes non-required spaces, delete empty rules, avoid new lines, etc.)
The –style options let choose a different output style than the compressed style:
The best to see how each style really looks like is for you to test with a large existing CSS file and check the output of csspp against that file.
For example, you could use the expanded
format before reading a file you found on a website as in:
This command line option prints out the version of the csspp compiler in stdout and then exits.
The –Werror requests the compiler to generate errors whenever a warning message was to be printed. This also has the side effect of incrementing the error counter by one each time a warning is found. Note that as a result the warning counter will always remains zero nin this case.
Other parameters specified on the command line, or parameters defined after a "--", are taken as .scss filenames. The "--" is mandatory if you have a preceeding argument that accepts multiple values like the –args and -I options.
Definition in file csspp.cpp.
Documentation of CSS Preprocessor.
This document is part of the Snap! Websites Project.
Copyright by Made to Order Software Corp.