1b2e7d2016-11-23Pontus Östlund /* Author: Pontus Östlund <https://profiles.google.com/poppanator> */
b9018d2016-11-29Pontus Östlund //! Sass is a scripting language that is interpreted into Cascading Style //! Sheets (CSS). This module is a glue for @tt{libsass@}. //! //! @seealso //! SASS @url{http://sass-lang.com/@}
1b2e7d2016-11-23Pontus Östlund  #pike __REAL_VERSION__
b9018d2016-11-29Pontus Östlund #require constant(Tools@module@)
1b2e7d2016-11-23Pontus Östlund  inherit Tools@module@; //! SCSS compiler
b9018d2016-11-29Pontus Östlund //! //! @example //! @code //! Tools.Sass.SCSS compiler = Tools.Sass.SCSS(); //! // Minify the output and create a source map file. //! compiler->set_options(([ //! "output_style" : Tools.Sass.STYLE_COMPRESSED //! "source_map_file" : "path/to/write/source.map" //! ])); //! //! if (mixed e = catch(compiler->compile_file("input.scss", "output.css"))) { //! werror("Failed compiling input.scss to output.css\n"); //! } //! @endcode
1b2e7d2016-11-23Pontus Östlund class SCSS {
b9018d2016-11-29Pontus Östlund  inherit Tools@module@.Api;
1b2e7d2016-11-23Pontus Östlund 
dd8a1a2016-11-29Pontus Östlund  //! Set options to the SASS compiler. @[opts]
1b2e7d2016-11-23Pontus Östlund  //! //! @param opts //! @mapping //! @member int "output_style" //! Any of the @[STYLE_NESTED], @[STYLE_EXPANDED], @[STYLE_COMPACT] //! or @[STYLE_COMPRESSED] constants. See also @[set_output_style()]. //! @member string "include_path" //! Path to root of incude files. See also @[set_include_path()]. //! @member string "source_map_file" //! File to write source map file to. Only has effect in @[compile_file()]. //! See also @[set_source_map_file()]. //! @member bool "source_comments" //! Turn on/off comments in the output containing info about the source
ef03332016-11-26Pontus Östlund  //! file - line numbers and such. Default of @tt{false@}. See also
1b2e7d2016-11-23Pontus Östlund  //! @[set_source_comments()]. //! @member bool "source_map_embed" //! Turn on/off if a source map should be embedded in the output or not.
ef03332016-11-26Pontus Östlund  //! Default is @tt{false@}. See also @[set_source_map_embed()].
1b2e7d2016-11-23Pontus Östlund  //! @endmapping void set_options(mapping(string:string|int) opts) { foreach (opts; string opt; string|int val) { switch (opt) { case "output_style": if (!intp(val)) { error("Value to set_output_style() must be an integer!\n"); } set_output_style(val); break; case "include_path": if (!stringp(val)) { error("Value to set_include_path() must be a string!\n"); } set_include_path(val); break; case "source_map_file": if (!stringp(val)) { error("Value to set_source_map_file() must be a string!\n"); } set_source_map_file(val); break; case "source_map_embed": if (!intp(val)) {
18ad792016-11-24Pontus Östlund  error("Value to set_source_map_embed() must be an int(0..1)!\n");
1b2e7d2016-11-23Pontus Östlund  } set_source_map_embed(val); break;
18ad792016-11-24Pontus Östlund  case "source_map_root": if (!stringp(val)) { error("Value to set_source_map_root() must be a string!\n"); } set_source_map_root(val); break; case "omit_source_map": if (!intp(val)) { error("Value to set_omit_source_map_url() must be an integer!\n"); } set_omit_source_map_url(val); break;
1b2e7d2016-11-23Pontus Östlund  case "source_comments": if (!intp(val)) { error("Value to set_source_comments() must be an integer!\n"); } set_source_comments(val); break;
18ad792016-11-24Pontus Östlund  default: error("Unknown option %O!\n", opt);
1b2e7d2016-11-23Pontus Östlund  } } }
dd8a1a2016-11-29Pontus Östlund  // //! Test if @[set_options()] will be linked to from @[a]? // //! // //! @param a // //! Just a parameter // void test_func(mapping a) // { // return a; // }
1b2e7d2016-11-23Pontus Östlund }