Download the PHP package itsahappymedium/fec without Composer
On this page you can find all versions of the php package itsahappymedium/fec. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download itsahappymedium/fec
More information about itsahappymedium/fec
Files in itsahappymedium/fec
Package fec
Short Description A PHP Command Line tool that makes it easy to compile, concat, and minify front-end Javascript and CSS/SCSS dependencies.
License MIT
Homepage https://github.com/itsahappymedium/fec
Informations about the package fec
Front End Compiler
A PHP Command Line tool that makes it easy to compile, concat, and minify front-end Javascript and CSS/SCSS dependencies.
The minify and scssphp packages do all of the heavy lifting, this tool simply combines the two into a single CLI tool with some extra features.
Installation
To a package (local)
To your system (global)
Usage
Running FEC without any arguments will load files from a fec.json
file that is structured like so:
Options
File paths can be passed to FEC to compile those specific files.
-
--css--output
/-c
- Define the path to a single file to concat all CSS/SCSS files into one file, or define a path to a directory to process each file individually with the.min.css
extension. -
--js--output
/-j
- Define the path to a single file to concat all JS files into one file, or define a path to a directory to process each file individually with the.min.js
extension. -
--no-minify
/-n
- Don't do any minification, just concat files. -
--path
/-p
- Defines a path to either a JSON file, or a directory where afec.json
file is located. -
--remove-important-comments
/-r
- Remove all comments, including those that are marked as important. This option also accepts a file name, or the last part of it's file path to only remove important comments from that file. You can also prepend the file name with a!
to remove important comments from all files but that file. You can pass multiple files by separating them with a comma (,
). -
--scss-import-path
/-s
- Define an additional path to check for SCSS imports in. You can pass multiple paths by separating them with a comma (,
). --watcher
/-w
- Define a path to point the EventSource to that will be injected into your JavaScript so that the page is refreshed when files are updated while running thewatch
command. (Seewatch
command section below for more information)
Examples
The watch
command
Starts a process that watches for file changes and recompiles them as needed. This command will do an initial compile just to make sure everything is up to date.
The Watcher
FEC has the ability to automatically refresh your website while running the watch
command (much like how Browsersync works). Simply create a watcher.php
(or whatever you want to call it) somewhere that is accessible by your website, and place the following code in there:
The FEC_Watcher
class accepts two parameters:
-
$files
(String/Array
) - Should be passed the path to a JavaScript file that FEC will generate or anArray
of JavaScript files. These files will have JavaScript injected into them by FEC to listen for changes. The array can also be multidimensional using the JavaScript file as the keys and additional files to watch for updates as the value (which accepts aString
or anArray
of Strings). $path
(String
) - All paths used in the$files
parameter should be relative to where the watcher script is placed. You can define a path with this parameter to prepend to all files listed in the$files
parameter.
Last, but not least, you will need to set the --watcher
option to the path where the watcher script is accessible on the server.
If a watcher is used, your files will be recompiled one last time after you are done to remove the injected JavaScript.
Defining Settings with JSON
You can set most options above by defining them as settings in your JSON file like so:
The scss-import-path
setting accepts a string or an array of strings, these paths are relative to the location of the JSON file.
Related
- GPM - A PHP Command Line tool that makes it easy to download dependencies from GitHub.
License
MIT. See the license.md file for more info.
All versions of fec with dependencies
matthiasmullie/minify Version ^1.3
scssphp/scssphp Version ^1.7
splitbrain/php-cli Version ^1.1