1.0.37 • Published 2 years ago

ccf v1.0.37

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

CCF (Compile Code Fast)

Compiles Javascript and SASS code into files that can be used in the browser

Install

You'll want to install ccf globally:

npm install ccf -g

NOTE: for this to work, you must also install SASS:

npm -g i sass

Usage

Once it's installed, just run ccf from any directory in your project that has an assets.json file!

ccf has some CLI options built into it by default. Use -h to see a list like this:

OptionDescription
-p, --productionRun in production mode.
-j, --javascriptOnly compile JavaScript code (SASS/CSS files are untouched).
-c, --cssOnly compile Sass code into Css (JavaScript files are untouched).
-f, --forceForce a new version for all assets, even if nothing has changed.
-i, --ignoreIgnore cached source MD5s while compiling.
-g, --gitAdd all compiled files to git automatically on completion.
-w, --watchWatch source files for changes after completion.
-v, --verboseWatch source files for changes after completion.
-h, --helpoutput usage information

You can use any number of options. For example:

ccf -fvp would start up ccf in production, verbose mode and force a version change.

You can also write your own commands using the ccfile.js as described in the "custom commands" section.

About "production"

Production turns on the following project options:

options.cssPrefix         = true;
options.compressCss       = true;
options.compressJs        = true;
options.addToGit          = true;
options.warnFilesNotSaved = true;

About "watch"

It's not advisable to use watch with production, force, ignore, or git.

It's very helpful if you are making frequent changes to some javascript files or SCSS files and you want to see the results right away.

Because of issues with working with cross-operating system file systems, there's a chance that it won't pick up your changes. Unfortunately, I don't think anything can be done about that. If you want to be sure you're running ccf, run it without watch. However, it should work 90% of the time.

Options

Here are the available options and their default values:

Optiondefault
versionTarget"./public/build/"
jsSource"./resources/assets/js/"
cssSource'./resources/assets/sass/'
revManifest'public/build/rev-manifest.json'
assets'assets.json'
versionSuffix(+new Date).toString(36)
cssPrefixfalse
compressCssfalse
compressJsfalse
compileJstrue
compileCsstrue
addToGitfalse
onlyUpdateOnSourceChangetrue
onlyUpdateOnResultChangetrue // basically no reason to turn this off
deleteOldBuildFilestrue
runOnFileChangefalse
warnFilesNotSavedfalse // warn me every time a file is not saved for any reason
filesToScanForChanges"resources/assets/js/", "resources/assets/sass/", "assets.json",
md5cacheFile""
autoPrefixerOptions{browsers : 'last 2 versions', cascade: false}
uglifyOptions{ warnings : false, / setting this to true is quite verbose.../toplevel : true,output : {code: true / MUST be true, or the code doesn't get outputted. (which would be useless)/}sourceMap: {} / this is populated automatically, leave blank. If you don't want source maps, delete this line./}/https://www.npmjs.com/package/uglify-js#minify-options,/};
commands[]
disableDefaultCommandsfalse

Any of these options can be overridden by placing a ccfile.js file in the project root directory, and exporting an options variable (see ccfile-example.js for an example)

Custom Commands

You can use the option.commands to create custom CLI options for your project. (see "options" about setting project options)

option.commands is an array of objects that look like this:

{
    name: "demoCommand",
    short: "d", // optional, uses the first letter of "name" if not given here. 
    description: "does the same thing as 'watch'", 
    callback: function(options) {
        options.runOnFileChange = true;
    }
}

You can use these custom commands to set custom option sets you frequently use.

License

ISC

1.0.33

2 years ago

1.0.32

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.37

2 years ago

1.0.36

2 years ago

1.0.35

2 years ago

1.0.34

2 years ago

1.0.26

3 years ago

1.0.25

3 years ago

1.0.24

3 years ago

1.0.29

3 years ago

1.0.28

3 years ago

1.0.27

3 years ago

1.0.23

4 years ago

1.0.22

4 years ago

1.0.21

4 years ago

1.0.20

4 years ago

1.0.19

4 years ago

1.0.18

5 years ago

1.0.17

5 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago