Skip to content

EtaiG/Smart-Sass-Exam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 

Repository files navigation

Smart Sass Exam

Sass is a language that compiles into CSS. It supports may useful features, such as nesting, variables, imports, inheritance, mixins and more.

In large projects with many Sass files, constantly compiling all the Sass files to CSS can be expensive during dev time.

Your goal: To create a 'Smart Sass' node module which, when run, will help to optimize the Sass compilation by deciding which files need to be compiled. How can the compilation be optimized? If compilation of a sass a file would have the same css output as before, then it does not need to be compiled again.

The module should receive an array of source directories/patterns as input, i.e. using glob, minimatch or the like, for example:

['components/**/*', 'widgets/**/*']

The pattern represents where the Sass files are located, and a target directory root, such as 'target/' which represents where the css files are written to using the same patterns of the source files, applied to the target root directory.

For example, if you received ['components/**/*', 'widgets/**/*'] as a the source patterns, then the css would be written at ['target/components/**/*', 'target/widgets/**/*'] respectively.

Your output should be an array of the files which need to be compiled.

###Guidelines:

  1. Although you do not need to actually compile the files, you should carefully read the features supported by Sass. There may be features you need to specifically account for when deciding which files need compilation.
  2. The module can have dependencies. Use of existing utilities and npm packages is encouraged (and likely necessary for a good solution). That said, the module should be able to be run by itself without being dependent on a task runner such as grunt to run it.
  3. You can write the module either as a synchronous task or an asynchronous one. The choice is yours.
  • If it's synchronous, it should return an array of the filepaths which need to be compiled by Sass.
  • If it's asynchronous, it should also accept a callback, which will be called upon completion with an array of the filepaths as the argument to the callback.
  1. Your submission should also wrap the module and log the result to the system console.

A synchronous version of the exported module should have the following signature:

function smartSass(sourcePatterns, targetDirectoryRoot){
 var filesWhichNeedSass = [];
 // .. 
 // ..
 return filesWhichNeedSass;
}

An asyncronous version of the exported module should have the following signature:

function smartSass(sourcePatterns, targetDirectoryRoot, callback){
 // var filesWhichNeedSass = [];
 // ..
 // ..
 // when done:
 // callback(err, filesWhichNeedSass);
}

The callback should support the node-style callbacks in order to support error reporting.

Please also submit a partial solution if you have not completed it. A partial solution is better than none at all.

###Send your solution as a zip file to etai@wix.com

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published