Commit f37befae authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Don't scan for CSS files.

JSDuck is really only meant for documenting JS and SCSS files.

Fixes #474
parent 9965f542
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ module JsDuck
      def format_member(m)
        @formatter.doc_context = m[:files][0]

        # Turn off type parsing for CSS vars and mixins
        # Turn off type parsing for SCSS vars and mixins
        @formatter.skip_type_parsing = [:css_var, :css_mixin].include?(m[:tagname])

        format_tags(m)
+1 −1
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ module JsDuck

      # Turns type parsing on or off.
      #
      # Used to skipping parsing of CSS var and mixin types.
      # Used to skipping parsing of SCSS var and mixin types.
      def skip_type_parsing=(skip)
        @subproperties.skip_type_parsing = skip
      end
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ module JsDuck
      end

      # Set to true to skip parsing and formatting of types.
      # Used to skip parsing of CSS typesdefs.
      # Used to skip parsing of SCSS typesdefs.
      attr_accessor :skip_type_parsing

      # Takes a hash of param, return value, throws value or subproperty.
+2 −2
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ module JsDuck

      # Expands opts.input_files (modifying its contents):
      #
      # - When file is a directory, scans all JS, CSS, SCSS files in there.
      # - When file is a directory, scans all JS, SCSS files in there.
      # - When file is a .jsb3 file, extracts list of files from it.
      # - Otherwise returns array with this same input filename.
      #
@@ -33,7 +33,7 @@ module JsDuck

        if File.exists?(fname)
          if File.directory?(fname)
            Dir[fname+"/**/*.{js,css,scss}"].each {|f| files << f }
            Dir[fname+"/**/*.{js,scss}"].each {|f| files << f }
          elsif fname =~ /\.jsb3$/
            Options::Jsb.read(fname).each {|fn| read_filenames(fn) }
          else
+5 −5
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ require 'jsduck/base_type'
require 'jsduck/class_doc_expander'

module JsDuck
  # Performs the actual parsing of CSS or JS source.
  # Performs the actual parsing of SCSS or JS source.
  #
  # This is the class that brings together all the different steps of
  # parsing the source.
@@ -27,7 +27,7 @@ module JsDuck
    def parse(contents, filename="", options={})
      @doc_processor.filename = @filename = filename

      parse_js_or_css(contents, filename, options).map do |docset|
      parse_js_or_scss(contents, filename, options).map do |docset|
        expand(docset)
      end.flatten.map do |docset|
        merge(docset)
@@ -36,9 +36,9 @@ module JsDuck

    private

    # Parses the file depending on filename as JS or CSS
    def parse_js_or_css(contents, filename, options)
      if filename =~ /\.s?css$/
    # Parses the file depending on filename as JS or SCSS
    def parse_js_or_scss(contents, filename, options)
      if filename =~ /\.scss$/
        docs = Css::Parser.new(contents, options).parse
      else
        docs = Js::Parser.new(contents, options).parse
Loading