/*
Serve assets in dev mode, by serving the files as they are.
352887
function (type, group) {
    return _.map(assetFiles(type, group), function (file) {
        return toHtml(type, path.join(config.root, fss.relative(file)));
    }).join('\n');
}
119331
function serve(name, options, init) {
    var _pkg = pkg();
    if (chek_1.isPlainObject(name)) {
        init = options;
        options = name;
        name = undefined;
    }
    if (chek_1.isBoolean(options)) {
        init = options;
        options = undefined;
    }
    var defaults = {
        server: {
            baseDir: './dist'
        }
    };
    name = name || 'dev-server';
    options = chek_1.extend({}, defaults, options);
    var bsync = chek_1.tryRootRequire('browser-sync');
    if (!bsync)
        logger_1.log.error('browser-sync not found try >> npm install browser-sync -s');
    var server = bsync.create(name);
    if (init !== false)
        server.init(options, function (err) {
            if (err) {
                logger_1.log.error(err);
            }
            else {
                logger_1.log.notify("browser Sync server " + name + " started.");
            }
        });
    return server;
}
1144624
function requireAssets( requireFile, assetPaths, assetUrlPaths ) {
   return function( assets ) {
      return Promise.all( Object.keys( assets ).map( key => {
         const asset = assets[ key ];

         if( ( assetPaths || [] ).indexOf( key ) >= 0 ) {
            return requireFile( asset, 'content' )
               .then( content => ( { [ key ]: { content } } ) );
         }

         if( ( assetUrlPaths || [] ).indexOf( key ) >= 0 ) {
            return requireFile( asset, 'url' )
               .then( url => ( { [ key ]: { url } } ) );
         }

         return {};
      } ) ).then( merge );
   };
}
535459
function resolveDependencies(self, paths) {
  var assets = [], cache = {};

  _.forEach(paths, function (p) {
    var asset;

    if (p === self.pathname) {
      if (!cache[p]) {
        cache[p] = true;
        assets.push(self);
      }
      return;
    }

    asset = self.environment.findAsset(p, { bundle: false });

    if (asset) {
      asset.__requiredAssets__.forEach(function (asset_dependency) {
        if (!cache[asset_dependency.pathname]) {
          cache[asset_dependency.pathname] = true;
          assets.push(asset_dependency);
        }
      });
    }
  });

  return assets;
}
28706
protected function _loadAssets()
    {
        $this->_View->Html->css('System./font-panel/fontpanel.css', ['block' => true]);
        $this->_View->Html->script('System./font-panel/fontpanel.js', ['block' => true]);
        $this->_View->Html->script('System./font-panel/font-panel-init.js', ['block' => true]);
    }
931508
protected function handleAssets()
    {
        $assetHandlerConnectorManager = $this->getAssetHandlerConnectorManager();

        // Default FormZ assets.
        $assetHandlerConnectorManager->includeDefaultAssets();

        // JavaScript assets.
        $assetHandlerConnectorManager->getJavaScriptAssetHandlerConnector()
            ->generateAndIncludeFormzConfigurationJavaScript()
            ->generateAndIncludeJavaScript()
            ->generateAndIncludeInlineJavaScript()
            ->includeJavaScriptValidationAndConditionFiles();

        // CSS assets.
        $assetHandlerConnectorManager->getCssAssetHandlerConnector()
            ->includeGeneratedCss();
    }
376055
def _handle_assets(self, relpath, params):
    """"""
    if self._settings.assets_dir:
      abspath = os.path.normpath(os.path.join(self._settings.assets_dir, relpath))
      with open(abspath, 'rb') as infile:
        content = infile.read()
    else:
      content = pkgutil.get_data(__name__, os.path.join('assets', relpath))
    content_type = mimetypes.guess_type(relpath)[0] or 'text/plain'
    self._send_content(content, content_type)
478389
public function serve()
    {
        $type       = $this->getSourceType();
        $sources    = $this->getSources();
        $contents   = $this->getContents();
        if ($type!='file' && count($sources)==1) {
            $response_data = array(
                'source'    => $sources[0],
                'content'   => $contents[0],
            );
        } else {
            $response_data = array(
                'sources'   => $sources,
                'contents'  => $contents,
            );
        }

        $errors_collection = $this->getErrors();
        $errors = array();
        foreach ($errors_collection as $_error) {
            $errors[] = $_error->getFullMessage();
        }
        $response_data['errors'] = $errors;

        if ($this->isDebug()) {
            $response_data['dump'] = serialize($this);
        }

        if (Container::get('request')->isMethod('head')) {
            Container::get('response')->fetchHeaders();
            exit(PHP_EOL);
        } else {
            try {
                Container::get('response')->send($response_data);
            } catch (\Exception $e) {
                $this->warning($e->getMessage());
                Container::get('response')
                    ->setContent(array('errors'=>$this->getErrors()))
                    ->fetch();
            }
        }
    }
142632
def serve(path=None, host=None, port=None, user_content=False, context=None,
          username=None, password=None, render_offline=False,
          render_wide=False, render_inline=False, api_url=None, title=None,
          autorefresh=True, browser=False, quiet=None, grip_class=None):
    
    app = create_app(path, user_content, context, username, password,
                     render_offline, render_wide, render_inline, api_url,
                     title, None, autorefresh, quiet, grip_class)
    app.run(host, port, open_browser=browser)
901427
def _serve_dir(self, abspath, params):
    """"""
    relpath = os.path.relpath(abspath, self._root)
    breadcrumbs = self._create_breadcrumbs(relpath)
    entries = [{'link_path': os.path.join(relpath, e), 'name': e} for e in os.listdir(abspath)]
    args = self._default_template_args('dir.html')
    args.update({'root_parent': os.path.dirname(self._root),
                 'breadcrumbs': breadcrumbs,
                 'entries': entries,
                 'params': params})
    content = self._renderer.render_name('base.html', args).encode("utf-8")
    self._send_content(content, 'text/html')
1066658
def serve(content):
    """"""
    temp_folder = tempfile.gettempdir()
    temp_file_name = tempfile.gettempprefix() + str(uuid.uuid4()) + ".html"
    # Generate a file path with a random name in temporary dir
    temp_file_path = os.path.join(temp_folder, temp_file_name)

    # save content to temp file
    save(temp_file_path, content)

    # Open templfile in a browser
    webbrowser.open("file://{}".format(temp_file_path))

    # Block the thread while content is served
    try:
        while True:
            time.sleep(1)
    except KeyboardInterrupt:
        # cleanup the temp file
        os.remove(temp_file_path)
1233372
function svgs(req, res) {
  const bundle = new Bundle(
    req.url.slice(1, -5).split('-').map(function map(name) {
      return assets[name];
    })
  );

  bundle.run(function (err, output) {
    if (err) throw err;

    res.setHeader('Content-Length', Buffer(output).length);
    res.writeHead(200, { 'Content-Type': 'text/plain' });

    res.end(output);
  });
}
1216532
def static(path, no_input):
    ''''''
    log = logging.getLogger('webassets')
    log.addHandler(logging.StreamHandler())
    log.setLevel(logging.DEBUG)

    cmdenv = CommandLineEnvironment(assets, log)
    cmdenv.build()

    if exists(path):
        warning('{0} directory already exists and will be {1}', white(path), white('erased'))
        if not no_input and not click.confirm('Are you sure'):
            exit_with_error()
        shutil.rmtree(path)

    echo('Copying assets into {0}', white(path))
    shutil.copytree(assets.directory, path)

    success('Done')
1165631
function serve() {
  util.log(util.colors.green('Serving unminified js'));

  nodemon({
    script: require.resolve('../server/server.js'),
    watch: [
      require.resolve('../server/server.js')
    ],
    env: {
      'NODE_ENV': 'development',
      'SERVE_PORT': port,
      'SERVE_HOST': host,
      'SERVE_USEHTTPS': useHttps,
      'SERVE_PROCESS_ID': process.pid,
      'SERVE_QUIET': quiet
    },
  })
  .once('quit', function () {
    util.log(util.colors.green('Shutting down server'));
  });
  if (!quiet) {
    util.log(util.colors.yellow('Run `gulp build` then go to ' + getHost()));
  }
}
92586
function serve (root, opts) {
  opts = Object.assign({}, opts)

  assert(root, 'root directory is required to serve files')

  // options
  debug('static "%s" %j', root, opts)
  opts.root = resolve(root)
  if (opts.index !== false) opts.index = opts.index || 'index.html'

  if (!opts.defer) {
    return async function serve (ctx, next) {
      let done = false

      if (ctx.method === 'HEAD' || ctx.method === 'GET') {
        try {
          done = await send(ctx, ctx.path, opts)
        } catch (err) {
          if (err.status !== 404) {
            throw err
          }
        }
      }

      if (!done) {
        await next()
      }
    }
  }

  return async function serve (ctx, next) {
    await next()

    if (ctx.method !== 'HEAD' && ctx.method !== 'GET') return
    // response is already handled
    if (ctx.body != null || ctx.status !== 404) return // eslint-disable-line

    try {
      await send(ctx, ctx.path, opts)
    } catch (err) {
      if (err.status !== 404) {
        throw err
      }
    }
  }
}
97207
function processFile(rootPath, preprocessor) {
  return (file, callback) => {
    if (preprocessor === StylePreprocessor.LESS) {
      const options = { paths: [rootPath], syncImport: true };
      less.render(file.data, options, (error, output) => {
        if (error) {
          console.error(`${file.path}: Could not render the LESS styles`);
          async.nextTick(callback, error);
          return;
        }

        const data = output.css;
        async.nextTick(callback, null, Object.assign({}, file, { data }));
      });
    } else {
      async.nextTick(callback, null, file);
    }
  };
}
1219189
def serve_assets(path):
    
    res = os.path.join(app.config['NIKOLA_ROOT'],
                       _site.config["OUTPUT_FOLDER"], 'assets')
    return send_from_directory(res, path)