Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I comment out a resource in Asset Pipeline Manifest

I needed to comment one of the files included in the application.js asset pipeleine manifest file,The way by which one add or include a file to the manifest is through comments in the manifest file . for instance require bootstrap means the bootstrap.css or bootstrap.js file is included into the application's css or javascript resources respectively. An example of the file is bellow

/*
 * This is a manifest file that'll be compiled into application.css, which will include      all the files
 * listed below.
 *
 * Any CSS file within this directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 *= require main
 *= require mobile
 *= require_self
 */
  console.log("This javascript is also added");

I want to comment out the main.css, not removing it, Searched online but did not find any useful information, With asset pipeline just introduced into grails 2.4 adopted from ruby on rails, I think it will be useful to be able to comment out a css or javascript resource in the asset pipeline manifest file.

like image 932
JohnTheBeloved Avatar asked Sep 27 '14 12:09

JohnTheBeloved


People also ask

What does rake assets precompile do?

rake assets:precompile. We use rake assets:precompile to precompile our assets before pushing code to production. This command precompiles assets and places them under the public/assets directory in our Rails application.

What is require_ tree in Rails?

The require_tree directive tells Sprockets to recursively include all JavaScript files in the specified directory into the output. These paths must be specified relative to the manifest file.

What are assets in Rails?

Generally asset is anything that browser loads after it gets the HTML page. Meaning javascript, css and any images. But as you pointed out there are two different image types in a rails project.

How do I compile the assets in the pipeline?

Rails comes bundled with a command to compile the asset manifests and other files in the pipeline. Compiled assets are written to the location specified in config.assets.prefix . By default, this is the /assets directory. You can call this command on the server during deployment to create compiled versions of your assets directly on the server.

How do I consume artifacts in azure pipelines?

If you have a pipeline that produces artifacts, you can consume the artifacts by defining a pipelines resource. pipelines is a dedicated resource only for Azure Pipelines. You can also set triggers on a pipeline resource for your CD workflows.

How does a resource get used in a pipeline?

How a resource gets used in a pipeline depends on the type of pipeline and type of resource. Service connections and secure files are directly used as inputs to tasks and don't need to be pre-declared. Variable groups use the group syntax. Pipelines and repositories use the resources syntax.

How do I declare an artifact in the pipeline?

A pipeline artifact can be declared as a resource in the resources section – primarily for the intent of triggering the pipeline when a new artifact is available, or to consume that artifact in the pipeline. Artifacts and work items aren't protected. Checks and pipeline permissions for feeds aren't supported.


1 Answers

Comments in this CSS manifest are no different than typical CSS comments. either // or /* ... */. The issue you have here is quite simple, you are overlooking the equals sign on the line you want to comment out. This equals sign indicates to the parser that it should act upon that line, removing the equals sign will turn that particular line into a comment.

So, to comment out main:

/*
 * This is a manifest file that'll be compiled into application.css, which will include      all the files
 * listed below.
 *
 * Any CSS file within this directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the top of the
 * compiled file, but it's generally better to create a new file per style scope.
 *
 * NOTICE: the line below does NOT begin with an equals sign, and will be treated as a comment.
 * require main
 *= require mobile
 *= require_self
 */
  console.log("This javascript is also added");
like image 192
Joshua Moore Avatar answered Oct 17 '22 06:10

Joshua Moore