This time I will show you how to operate css files with r.js, and what are the precautions for operating css files with r.js. The following is a practical case, let's take a look.
main.css is the merged main file, or configuration file. The files to be merged are imported using @import. As follows
main.css@importurl("nav.css"); @importurl("grid.css"); @importurl("form.css");
node r.js -o cssIn=css/main.css out=css/built.css
When you return to the r5/css directory, you will find an additional built.css file, which is a merger of four other css files. You can also use optimizeCss parameter settings to configure whether to compress and compress options. The values of optimizeCss are standard/none/standard.keepLines/standard.keepComments/standard.keepComments.keepLines. none No compression, only mergestandard Standard compression removes line breaks, spaces, standard.keepLines In addition to standard compression, line breaks are retainedstandard.keepCommentsKeep comments except for standard compressionstandard.keepComments.keepLinesKeep newlines and comments except for standard compressionExample:
node r.js -o cssIn=css/main.css out=css/built.css optimizeCss=standard
The above is the detailed content of How to operate css files with r.js. For more information, please follow other related articles on the PHP Chinese website!