traverse the static folders an look for at least one file ending in .scss/.sass
558313
def traverse_tree(cls, static_dir):
        """"""
        for root, dirs, files in os.walk(static_dir):
            for filename in files:
                if cls._pattern.match(filename):
                    APPS_INCLUDE_DIRS.append(static_dir)
                    return
35582
def find_files(root, pattern):
    
    results = []
    for base, dirs, files in os.walk(root):
        matched = fnmatch.filter(files, pattern)
        results.extend(os.path.join(base, f) for f in matched)
    return results
575698
def urls_from_file_tree(template_dir):
    """"""
    urls = []  # keep a list of of all the files/paths

    # Should be somethign like:
    # /path/to/myproject/templates/staticflatpages
    root_dir = join(template_dir, 'staticflatpages')

    for root, dirs, files in walk(template_dir):
        # Only do this for the ``staticflatpages`` directory or sub-directories
        if "staticflatpages" in root:
            root = root.replace(root_dir, '')
            for f in files:
                path = join(root, f)
                path = _format_as_url(path)
                urls.append(path)
    return urls
532841
def collect_static(static_folder):
    
    appbuilder_static_path = os.path.join(
        os.path.dirname(os.path.abspath(__file__)), "static/appbuilder"
    )
    app_static_path = os.path.join(os.getcwd(), static_folder)
    if not os.path.isdir(app_static_path):
        click.echo(
            click.style(
                "Static folder does not exist creating: %s" % app_static_path,
                fg="green",
            )
        )
        os.makedirs(app_static_path)
    try:
        shutil.copytree(
            appbuilder_static_path, os.path.join(app_static_path, "appbuilder")
        )
    except Exception:
        click.echo(
            click.style(
                "Appbuilder static folder already exists on your project", fg="red"
            )
        )
1217774
def find_files_relative(directory, files)
      return [] unless files.any?
      files.each_with_object([]) do |file, obj|
        path = "#{directory}/#{file}"
        obj << path if File.exist?(path)
      end
    end
952754
def _walk(self):
        """"""

        self._base_len = len(self.base)

        for base, dirs, files in os.walk(self.base, followlinks=self.follow_links):
            # Remove child folders based on exclude rules
            for name in dirs[:]:
                try:
                    if not self._valid_folder(base, name):
                        dirs.remove(name)
                except Exception:
                    dirs.remove(name)
                    value = self.on_error(base, name)
                    if value is not None:  # pragma: no cover
                        yield value

                if self._abort:
                    break

            # Search files if they were found
            if len(files):
                # Only search files that are in the include rules
                for name in files:
                    try:
                        valid = self._valid_file(base, name)
                    except Exception:
                        valid = False
                        value = self.on_error(base, name)
                        if value is not None:
                            yield value

                    if valid:
                        yield self.on_match(base, name)
                    else:
                        self._skipped += 1
                        value = self.on_skip(base, name)
                        if value is not None:
                            yield value

                    if self._abort:
                        break

            if self._abort:
                break
325043
def find_file(name, directory):
    """"""
    path_bits = directory.split(os.sep)
    for i in range(0, len(path_bits) - 1):
        check_path = path_bits[0:len(path_bits) - i]
        check_file = "%s%s%s" % (os.sep.join(check_path), os.sep, name)
        if os.path.exists(check_file):
            return abspath(check_file)

    return None
999938
function getImportAbsolutePath(url, prev, includedFilesMap, includedPaths = []) {
  // Ensure that both @import 'file' and @import 'file.scss' is mapped correctly
  let extension = path.posix.extname(prev);
  if(path.posix.extname(url) !== extension) {
    url += extension;
  }

  const absolutePath = findImportedPath(url, prev, includedFilesMap, includedPaths);

  if(!absolutePath) {
    throw new Error(`Can not determine imported file for url '${url}' imported in ${prev}`);
  }

  return absolutePath;
}
145752
function paths(dir) {
	var paths = [];

	try {
		fs.statSync(dir);
	}
	catch (e) {
		return e;
	}

	(function traverse(dir, stack) {
		stack.push(dir);
		fs.readdirSync(stack.join('/')).forEach(function(file) {
			var path = stack.concat([file]).join('/'),
				stat = fs.statSync(path);

			if (file[0] == '.' || file === 'vendor') {
				return;
			} else if (stat.isFile() && /\.js$/.test(file)) {
				paths.push(path);
			} else if (stat.isDirectory()) {
				paths.push(path);
				traverse(file, stack);
			}
		});
		stack.pop();
	})(dir || '.', []);

	return paths;
}
937548
function (patternFolder, cb) {
    // read pattern folder
    fs.readdir(patternFolder, function (err, contents) {
      // check for errors
      if (err !== null && err.code === 'ENOENT') {
        grunt.log.error('Cannot find patterns folder:', patternFolder);
        cb('Cannot find patterns folder: ' + patternFolder);
        return;
      }

      // list all pattern files (that end with .html)
      var files = [];
      contents.forEach(function (content) {
        if (content.substr(-5) === '.html') {
          files.push(content);
        }
      });
      // handle all the found pattern files
      handleFiles(patternFolder, files, cb);
    });
  }
976485
function sass() {
  return gulp.src('src/assets/scss/app.scss')
    .pipe($.if(!PRODUCTION, $.sourcemaps.init()))
    .pipe($.sass({
      includePaths: ['node_modules/foundation-emails/scss']
    }).on('error', $.sass.logError))
    .pipe($.if(PRODUCTION, $.uncss(
      {
        html: ['dist/**/*.html']
      })))
    .pipe($.if(!PRODUCTION, $.sourcemaps.write()))
    .pipe(gulp.dest('dist/css'));
}
1204066
def _find_paths(self, current_dir, patterns):
        """"""
        pattern = patterns[0]
        patterns = patterns[1:]
        has_wildcard = is_pattern(pattern)
        using_globstar = pattern == "**"

        # This avoids os.listdir() for performance
        if has_wildcard:
            entries = [x.name for x in scandir(current_dir)]
        else:
            entries = [pattern]

        if using_globstar:
            matching_subdirs = map(lambda x: x[0], walk(current_dir))
        else:
            subdirs = [e for e in entries
                       if os.path.isdir(os.path.join(current_dir, e))]
            matching_subdirs = match_entries(subdirs, pattern)

        # For terminal globstar, add a pattern for all files in subdirs
        if using_globstar and not patterns:
            patterns = ['*']

        if patterns:  # we've still got more directories to traverse
            for subdir in matching_subdirs:
                absolute_path = os.path.join(current_dir, subdir)
                for match in self._find_paths(absolute_path, patterns):
                    yield match

        else:  # we've got the last pattern
            if not has_wildcard:
                entries = [pattern + '.wsp', pattern + '.wsp.gz']
            files = [e for e in entries
                     if os.path.isfile(os.path.join(current_dir, e))]
            matching_files = match_entries(files, pattern + '.*')

            for _basename in matching_files + matching_subdirs:
                yield os.path.join(current_dir, _basename)
1066849
private function getStylesheetsMaxAge()
    {
        if (is_null($this->cssPath)) {
            $this->findPaths();
            $this->checkPaths();
        }
        return $this->getFilesMaxAge($this->cssPath, array('*.css'));
    }
1024943
def resolve(context, path)
      context.resolve(path, content_type: 'text/css')
    rescue ::Sprockets::FileNotFound
      begin
        context.resolve(path + '/index', content_type: 'text/css')
      rescue
        nil
      end
    end
1257049
def discover_static_files(base_path, sub_path=''):
    
    js_files = discover_files(base_path, sub_path=sub_path,
                              ext='.js', trim_base_path=True)
    sources, mocks, specs = sort_js_files(js_files)
    html_files = discover_files(base_path, sub_path=sub_path,
                                ext='.html', trim_base_path=True)

    p = path.join(base_path, sub_path)
    _log(sources, 'JavaScript source', p)
    _log(mocks, 'JavaScript mock', p)
    _log(specs, 'JavaScript spec', p)
    _log(html_files, 'HTML template', p)

    return sources, mocks, specs, html_files
1021324
def compile_scss_normal
        Dir["#{@path}.scss"].select { |f| File.file? f }.each do |file|
          next if File.basename(file).chr == '_'
          scss_file = File.open(file, 'rb') { |f| f.read }

          output_file = File.open( file.split('.').reverse.drop(1).reverse.join('.'), "w" )
          output_file << Sass::Engine.new(scss_file, { syntax: :scss, quiet: true, style: :compressed }).render
          output_file.close
        end
      end
710053
def find(self, path, all=False):
        
        matches = []
        for elem in chain(settings.STYLESHEETS.values(), settings.JAVASCRIPT.values()):
            if normpath(elem['output_filename']) == normpath(path):
                match = safe_join(settings.PIPELINE_ROOT, path)
                if not all:
                    return match
                matches.append(match)
        return matches