Cope all front end related files
Website routes, controllers, views, assets, webpack
511500
private function copyAllWebsiteFiles()
    {
        // routes

        // VIEWS
        $source = "{$this->basePath}resources{$this->ds}views{$this->ds}website";
        $destination = resource_path("views{$this->ds}website");
        $this->copyFilesFromSource($source, $destination);

        // WEBSITE master layout
        $source = "{$this->basePath}resources{$this->ds}views{$this->ds}layouts{$this->ds}website.blade.php";
        $destination = resource_path("views{$this->ds}layouts");
        $this->copyFilesFromSource($source, $destination);

        // PARTIALS
        $source = "{$this->basePath}resources{$this->ds}views{$this->ds}partials";
        $destination = resource_path("views{$this->ds}partials");
        $this->copyFilesFromSource($source, $destination);

        // CONTROLLERS
        $source = "{$this->appPath}Controllers{$this->ds}Website";
        $destination = app_path("Http{$this->ds}Controllers{$this->ds}Website");

        // copy files and replace namespace and views only
        $this->copyFilesFromSource($source, $destination, 'namespace_views');

        // SEEDS
        $search = "{$this->baseNamespace}\Seeds;";
        $source = "{$this->basePath}database{$this->ds}seeds{$this->ds}UsersTableSeeder.php";
        $destination = database_path("seeds");
        $this->copyFilesFromSource($source, $destination, $search, "");

        // EVENTS (todo, admin for now)
        // MAILS (todo, admin for now)
        // NOTIFICATIONS (todo, admin for now)

        // webpack.js, packages.json root files
        $base = $source = $this->basePath . "resources" . $this->ds . "assets_setup" . $this->ds;
        $source = [
            $base . "webpack.mix.js",
            $base . "package.json",
            $base . "package-lock.json",
        ];
        $this->copyFilesFromSource($source, base_path(), false);

        // ASSETS
        $source = "{$this->basePath}resources{$this->ds}assets{$this->ds}";
        $destination = resource_path("assets{$this->ds}");
        // css
        $this->copyFilesFromSource("{$source}css", "{$destination}css", false);
        // fonts
        $this->copyFilesFromSource("{$source}fonts", "{$destination}fonts", false);
        // images
        $this->copyFilesFromSource("{$source}images", "{$destination}images", false);
        // js
        $this->copyFilesFromSource("{$source}js", "{$destination}js", false);
        // sass
        $this->copyFilesFromSource("{$source}sass", "{$destination}sass", false);

        // public/assets
        $this->copyFilesFromSource($this->basePath . 'public', base_path('public'));
    }
912378
function complete() {
  quit();

  const deleteQueue = [];
  fs.readdir(paths.output, (err, files) => {
    if (files) {
      // lookup array for quick search inside existing component names
      const componentsLookup = components.map(item => {
        return slugify(item.meta.name);
      });

      // loop over files
      for (let i = 0, l = files.length; i < l; ++i) {
        const file = files[i];
        const ext = path.extname(file);

        // ignore dot files
        if (file.indexOf(".") === 0) {
          continue;
        }

        // if json+html file isn't inside lookup, mark for deletion
        if (componentsLookup.indexOf(path.basename(file, ext)) === -1) {
          deleteQueue.push(file);
        }
      }
    }

    // remove file by passing shorter queue
    function removeFile(q) {
      if (!q.length) {
        process.send(true);
        return;
      }

      const file = q.shift();
      rimraf(path.resolve(paths.output, file), { read: false }, () => {
        removeFile(q);
      });
    }

    removeFile(deleteQueue);
  });
}
1026031
function(){
      console.log('');
      this.log('Usage: generate [resource]');
      this.log('Resources:');
      this.log('  all                    generates all components', false);
      this.log('  models                 generates all models', false);
      this.log('  controllers            generates all controllers', false);
      this.log('  configs                generates default configs', false);
      this.log('  views                  generates default view templates', false);
      this.log('  policies               generates all policies');
    }
30170
private static function loadRoutes()
    {
        // Media Manager Routes
        Route::group(['prefix' => config('media-manager.routes.prefix')], function () {
            Route::get('browser/index', '\TalvBansal\MediaManager\Http\Controllers\MediaController@ls');

            Route::post('browser/file', '\TalvBansal\MediaManager\Http\Controllers\MediaController@uploadFiles');
            Route::delete('browser/file', '\TalvBansal\MediaManager\Http\Controllers\MediaController@deleteFile');
            Route::post('browser/folder', '\TalvBansal\MediaManager\Http\Controllers\MediaController@createFolder');
            Route::delete('browser/folder', '\TalvBansal\MediaManager\Http\Controllers\MediaController@deleteFolder');

            Route::post('browser/rename', '\TalvBansal\MediaManager\Http\Controllers\MediaController@rename');
            Route::get('browser/directories', '\TalvBansal\MediaManager\Http\Controllers\MediaController@allDirectories');
            Route::post('browser/move', '\TalvBansal\MediaManager\Http\Controllers\MediaController@move');
        });
    }
427121
protected function requireFrontend() {
		$extension = Director::isLive() ? '.min' : '';
		$cssFiles = array(
			CROPPERFIELD_PATH . '/cropper/cropper' . $extension . '.css',
			CROPPERFIELD_PATH . '/cropper/CropperField.css',
		);
		$jsFiles = array(
			CROPPERFIELD_PATH . '/cropper/cropper' . $extension . '.js',
			CROPPERFIELD_PATH . '/cropper/CropperField.js',
		);
		Requirements::combine_files('cropperfield-all.css', $cssFiles);
		Requirements::combine_files('cropperfield-all.js', $jsFiles);
	}
576027
public function front()
    {
        $html = '';

        // Looping on plugins found inside the dragdrop zone to render them through their plugins
        // and get the HTML resulting in everything

        $plugins     = array();
        $containerId = null;
        foreach ($this->pluginFrontConfig['plugins'] as $plugin)
        {

            $tmpHtml = null;
            $datas = array(
                'action' => 'getPlugin',
                'module' => $plugin['pluginModule'],
                'pluginName' => $plugin['pluginName'],
                'pluginId' => $plugin['pluginId'],
                'pageId' => $this->pluginFrontConfig['pageId'],
                'fromDragDropZone' => true,
            );

            try
            {
                $forwardPlugin = $this->getController()->forward();

                $jsonResults = $forwardPlugin->dispatch('MelisFront\\Controller\\MelisPluginRenderer', $datas);


                if (!empty($jsonResults))
                {
                    $variables = $jsonResults->getVariables();
                    $containerId = isset($variables['datas']['dom']['pluginContainerId']) ?
                        $variables['datas']['dom']['pluginContainerId'] : count($plugins);

                    if (!empty($variables['success'])) {
                        //$html .= $variables['datas']['html'];
                        $tmpHtml = $variables['datas']['html'];
                    }

                    else  {
                        // problem with the plugins, we show the error only BO side
                        if ($this->renderMode == 'melis') {
                            //$html .= $variables['errors'] . ' : ' . $plugin['pluginModule'] . ' / ' . $plugin['pluginName'];
                            $tmpHtml = $variables['errors'] . ' : ' . $plugin['pluginModule'] . ' / ' . $plugin['pluginName'];
                        }
                    }

                }
            }
            catch (\Exception $e)
            {
                return array('pluginId' => $this->pluginFrontConfig['id']);

            }

            $plugins[$containerId][] = $tmpHtml;

        }


        // add container to dragdropzone

        $newHtml = !$this->isInBackOffice() ? '<div class="clearfix">' : '';
        foreach($plugins as $containerId => $contents) {
            foreach($contents as $idx => $content) {
                $newHtml .= "\t" . $content;
            }
        }

        $newHtml .= !$this->isInBackOffice() ? '</div>' : '';

        // Create an array with the variables that will be available in the view
        $viewVariables = array(
            'pluginId' => $this->pluginFrontConfig['id'],
            'pluginsHtml' => $newHtml,
        );

        // return the variable array and let the view be created
        return $viewVariables;
    }
992464
function() {
      // locale InsFrame root folder
      homeFolder = __dirname;
      console.log("   info  -".cyan, "InsFrame root".yellow, homeFolder);

      // express config
      app.set("view engine", "ejs");
      app.set("views", homeFolder + "/views");
      app.set("views");
      app.set("view options", { layout: null });

      // static resources
      app.use("/js", express.static(homeFolder + "/js"));
      app.use("/css", express.static(homeFolder + "/css"));
      app.use("/images", express.static(homeFolder + "/images"));

      // port
      port = this.port || parseInt(process.argv[2]) || PORT;

      // Timer to send close requests when timeout occurs.
      setInterval(function() {
        for (var id in urlData) {
          urlData[id].timeout -= CHECK_INTERVAL;
          if (urlData[id].timeout <= 0) {
            io.sockets.emit("close", { id: id, url: urlData[id].url });
            console.log("   info  -".cyan, "close/timeout".yellow, JSON.stringify(urlData[id]));
            delete urlData[id];
          }
        }
      }, CHECK_INTERVAL);
    }
170776
protected function mapRoutes()
    {
        if (!$this->app->routesAreCached()) {
            Route::group(
                ['middleware' => ['web']], function () {
                    $routes = new Routes();

                    // Backend Routes
                    $routes->mapBackendRoutes()
                        ->mapPluginsBackendRoutes();

                    // Frontend Routes
                    $routes->mapFrontendBaseRoutes()
                        ->mapFrontendRoutes()
                        ->mapThemeRoutes()
                        ->mapPluginsFrontendRoutes();

                    // Add Language {lang} prefix
                    $routes->addLanguagePrefix()
                        ->sortRoutes();
                }
            );
        }
    }
1140833
function embed(sourcePath, relativePaths, name, done) {
  var items = '';
  each(relativePaths, function(relativePath, next) {
    var fullPath = path.join(sourcePath, relativePath);
    fs.readFile(fullPath, 'utf8', function(err, text) {
      if (err) return next(err);
      items += '  $templateCache.put(\'' +
        inline(relativePath) + '\', \'' +
        inline(text.trim()) + '\');\n';
      next();
    });
  }, function(err) {
    if (err) return done(err);
    console.log(
      'angular.module(\'' + inline(name) + '\', []).run([\'$templateCache\', function($templateCache) {\n' +
      items +
      '}]);');
    done();
  });
}
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)
192190
function(path, partials)
    {
      var templates = { };

      grunt.file.recurse(path, function (absPath, rootDir, subDir, filename)
      {
        // ignore non-template files
        if (!filename.match(matcher)) {
          return;
        }

        // read template source and data
        var relPath  = absPath.substr(rootDir.length + 1),
          tmpData  = absPath.replace(matcher, '.json'),
          tmpSrc   = grunt.file.read(absPath),

          // template name based on path (e.g. "index", "guide/index", etc)
          name     = relPath.replace(matcher, ''),

          // set-up template specific locals
          locals   = mustatic.merge({}, globals);

        // add template URL to locals
        locals.url = name + '.html';

        // load template data and merge into locals
        if (grunt.file.exists(tmpData)) {
          locals = mustatic.merge(locals, JSON.parse(grunt.file.read(tmpData)));
        }

        // store locals
        data[name] = locals;

        templates[name] = hogan.compile(tmpSrc);
      });

      return templates;
    }
1098064
public function mapFrontendRoutes()
    {
        $directory = base_path('routes');
        if(is_dir($directory)) {
            $routeFiles = File::files($directory);

            $excludeRoutes = ['base.php', 'api.php'];

            Route::group(
                [
                'middleware' => $this->middleware['frontend'],
                ], function () use ($routeFiles, $excludeRoutes) {
                    foreach ($routeFiles as $file) {
                        // Base.php is loaded from FrontendBaseRoutes method
                        if (!in_array($file->getFilename(), $excludeRoutes)) {
                            include $file;
                        }
                    }
                }
            );
        }
        return $this;
    }
244142
protected function exportControllers()
    {
        foreach ($this->controllers as $pathIn => $pathOut) {
            if ($this->files->exists($controller = app_path('Http/Controllers/'.$pathOut))
                && ! $this->option('force')) {
                if (! $this->confirm("The [{$pathOut}] controller already exists. Do you want to overwrite it?")) {
                    continue;
                }
            }

            $this->files->put(
                $controller,
                $this->compileStub($this->files->get(__DIR__.'/stubs/make/controllers/'.$pathIn))
            );
        }
    }
767012
protected function mapWebRoutes()
    {
        Route::group([
            'middleware' => config($this->package.'.web_routes_middleware') ?: 'web',
            'namespace'  => $this->namespace,
            'prefix' => $this->prefix,
        ], function ($router) {
            require __DIR__.'/../Routes/web.php';
        });
    }
790326
public function addAllControllers(): void
    {
        $controllers = [];

        // app/controllers/posts/*_controller.js
        $folder = new Folder(WWW_ROOT . 'js/app/controllers');
        foreach ($folder->findRecursive('.*\.js') as $file) {
            $jsFile = '/' . str_replace(WWW_ROOT, '', $file);
            $controllers[] = $jsFile;
        }

        // Add All Plugin Controllers
        foreach (Plugin::loaded() as $pluginName) {
            $pluginPath = Plugin::path($pluginName);
            $pluginJsControllersFolder = $pluginPath . (substr($pluginPath, -1) === '/' ? '' : '/') . 'webroot/js/app/controllers/';
            $pluginJsControllersFolder = str_replace('\\', '/', $pluginJsControllersFolder);

            if (is_dir($pluginJsControllersFolder)) {
                $this->_pluginJsNamespaces[] = $pluginName;
                $folder = new Folder($pluginJsControllersFolder);
                $files = $folder->findRecursive('.*\.js');

                foreach ($files as $file) {
                    $file = str_replace('\\', '/', $file);
                    $file = str_replace($pluginJsControllersFolder, '', $file);
                    if ($this->_assetCompressMode) {
                        $controllers[] = 'plugin:' . $pluginName . ':js/app/controllers/' . $file;
                    } else {
                        $controllers[] = '/' . Inflector::underscore($pluginName) . '/js/app/controllers/' . $file;
                    }
                }
            }
        }

        // Move all controllers with base_ prefix to the top, so other controllers
        // can inherit from them
        foreach ($controllers as $n => $file) {
            if (substr(basename($file), 0, 5) == 'base_') {
                unset($controllers[$n]);
                array_unshift($controllers, $file);
            }
        }
        foreach ($controllers as $file) {
            $this->_addDependency($file);
        }
    }
619077
def clean(context: Context, delete_dependencies: bool = False):
    
    paths = [context.app.asset_build_path, context.app.collected_assets_path, context.app.govuk_templates_path,
             'docker-compose.yml', 'package.json', 'package-lock.json', 'webpack.config.js']
    context.shell('rm -rf %s' % paths_for_shell(paths))
    context.shell('find %s -name "*.pyc" -or -name __pycache__ -delete' % context.app.django_app_name)

    if delete_dependencies:
        context.info('Cleaning app %s dependencies' % context.app.name)
        paths = ['node_modules', 'venv']
        context.shell('rm -rf %s' % paths_for_shell(paths))
312675
public function resourceAssets()
    {
        return [
            ADMINLTETEMPLATE_PATH.'/resources/assets/css' => resource_path('assets/css'),
            ADMINLTETEMPLATE_PATH.'/resources/assets/img' => resource_path('assets/img'),
            ADMINLTETEMPLATE_PATH.'/resources/assets/js'   => resource_path('assets/js'),
            ADMINLTETEMPLATE_PATH.'/webpack.mix.js'        => base_path('webpack.mix.js'),
            ADMINLTETEMPLATE_PATH.'/package.json'          => base_path('package.json'),
        ];
    }