Skip to content

Commit

Permalink
Merge pull request #10 from helly0d/master
Browse files Browse the repository at this point in the history
baseDir as array and added output wrapper
  • Loading branch information
knyga committed Mar 19, 2014
2 parents 67a55f8 + 9be307d commit d9dec52
Show file tree
Hide file tree
Showing 8 changed files with 471 additions and 401 deletions.
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,16 @@ Requires Java Runtime Environment version 7.
###Kjscompile.json
Instead of kjscompile.json you can specify your own path to configuration file with `--settings %path%` attribute.

`basedir` - directory with JavaScript files;
`basedir` - directory or array of directories with JavaScript files;

`output` - output JavaScript file name;

`pattern` - rule for filename (*.js);

`level` - level of optimization (WHITESPACE_ONLY, SIMPLE_OPTIMIZATIONS, ADVANCED_OPTIMIZATIONS).

`wrapper` - setting to wrap your output. The place holder is "%output%".

Example:
```javascript
{
Expand All @@ -37,6 +39,20 @@ Example:
"pattern": "*.js"
}
```
Example:
```javascript
{
"basedir": ["lib/javascript", "lib/ecmascript"],
"output": "js.min/all.js",
"level": "SIMPLE_OPTIMIZATIONS",
"pattern": "*.js",
"wrapper" : "(function(){ %output% }());"
}
```

Note:
Any path will be relative to the settings file. If none provided it will be relative to the current working directory ( the directory where you launched kjscompiler ).


###Annotating JavaScript files
Kjscompiler can use information about JavaScript file to build right compiling chain.
Expand Down Expand Up @@ -64,7 +80,7 @@ Kjscompiler can use information about JavaScript file to build right compiling c

```javascript
/**
* kjscompilerannotation
* kjscompiler annotation
* @external
*/
```
Expand Down
2 changes: 1 addition & 1 deletion src/kjscompile/ArgScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package kjscompile;
package kjscompiler;

import java.util.Hashtable;

Expand Down
2 changes: 1 addition & 1 deletion src/kjscompile/FileInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package kjscompile;
package kjscompiler;

import java.io.File;
import java.io.FileReader;
Expand Down
14 changes: 5 additions & 9 deletions src/kjscompile/FileScanner.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,24 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package kjscompile;
package kjscompiler;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;

/**
*
* @author agnynk
*/
public class FileScanner {
private static List<String> result;

public static List<String> run(String rootPath, String search) {
public static List<String> run(String rootPath, String search, String projectPath) {
result = new ArrayList<String>();

String ptext = "^" + (search.replace(".", "\\.").replace("*", ".*"))
+ "$";

processFileRecursively(new File(rootPath), ptext);

String ptext = "^" + (search.replace(".", "\\.").replace("*", ".*")) + "$";

processFileRecursively(new File(projectPath, rootPath), ptext);
return result;
}

Expand Down
Loading

0 comments on commit d9dec52

Please sign in to comment.