diff --git a/django/contrib/staticfiles/storage.py b/django/contrib/staticfiles/storage.py
index d085cf7..98e1cf4 100644
--- a/django/contrib/staticfiles/storage.py
+++ b/django/contrib/staticfiles/storage.py
@@ -248,13 +248,14 @@ class CachedFilesMixin(object):
                 # ..to apply each replacement pattern to the content
                 if name in adjustable_paths:
                     content = original_file.read().decode(settings.FILE_CHARSET)
-                    for patterns in self._patterns.values():
-                        for pattern, template in patterns:
-                            converter = self.url_converter(name, template)
-                            try:
-                                content = pattern.sub(converter, content)
-                            except ValueError as exc:
-                                yield name, None, exc
+                    for extension, patterns in self._patterns.iteritems():
+                        if matches_patterns(path, (extension,)):
+                            for pattern, template in patterns:
+                                converter = self.url_converter(name, template)
+                                try:
+                                    content = pattern.sub(converter, content)
+                                except ValueError as exc:
+                                    yield name, None, exc
                     if hashed_file_exists:
                         self.delete(hashed_name)
                     # then save the processed result
diff --git a/tests/staticfiles_tests/storage.py b/tests/staticfiles_tests/storage.py
index 4d49e6f..dfee5f3 100644
--- a/tests/staticfiles_tests/storage.py
+++ b/tests/staticfiles_tests/storage.py
@@ -24,3 +24,13 @@ class SimpleCachedStaticFilesStorage(CachedStaticFilesStorage):
 
     def file_hash(self, name, content=None):
         return 'deploy12345'
+
+
+class MultiCachedStaticFilesStorage(CachedStaticFilesStorage):
+    patterns = tuple(CachedStaticFilesStorage.patterns) + (
+        (
+            "*.js", (
+                (r"""(url\(['"]{0,1}\s*(.*?)["']{0,1}\))""", 'JS_URL("%s")'),
+            ),
+        ),
+    )
diff --git a/tests/staticfiles_tests/tests.py b/tests/staticfiles_tests/tests.py
index 912dcff..c11f983 100644
--- a/tests/staticfiles_tests/tests.py
+++ b/tests/staticfiles_tests/tests.py
@@ -349,6 +349,7 @@ class TestCollectionFilesOverride(CollectionTestCase):
         self.assertFileContains('file2.txt', 'duplicate of file2.txt')
 
 
+
 @override_settings(
     STATICFILES_STORAGE='staticfiles_tests.storage.DummyStorage',
 )
@@ -566,6 +567,57 @@ class TestCollectionCachedStorage(BaseCollectionTestCase,
         self.assertEqual("Post-processing 'faulty.css' failed!\n\n", err.getvalue())
 
 
+@override_settings(
+    **dict(
+        TEST_SETTINGS,
+        STATICFILES_STORAGE=(
+            'staticfiles_tests.storage.MultiCachedStaticFilesStorage'
+        ),
+        DEBUG=False, # see note above
+    )
+)
+class TestMultiCachedStorage(
+       BaseCollectionTestCase,
+       BaseStaticFilesTestCase,
+       TestCase,
+):
+    def cached_file_path(self, path):
+        fullpath = self.render_template(self.static_template_snippet(path))
+        return fullpath.replace(settings.STATIC_URL, '')
+
+    def test_multi_extension_patterns(self):
+        """ #19670 """
+        storage.staticfiles_storage.cache.clear() # avoid interference
+        import pdb; pdb.set_trace()
+
+        self.assertEqual(
+            settings.STATICFILES_STORAGE,
+            'staticfiles_tests.storage.MultiCachedStaticFilesStorage'
+        )
+        self.assertEqual(
+            storage.staticfiles_storage._wrapped.__class__.__name__,
+            'MultiCachedStaticFilesStorage'
+        )
+
+        # confirm CSS files haven't been touched by JS patterns
+        relpath = self.cached_file_path("cached/import.css")
+        self.assertEqual(relpath, "cached/import.2b1d40b0bbd4.css")
+        with storage.staticfiles_storage.open(relpath) as relfile:
+            self.assertIn(
+                b"""import url("styles.93b1147e8552.css")""",
+                relfile.read()
+            )
+
+        # confirm JS patterns have been applied to JS files
+        relpath = self.cached_file_path("cached/test.js")
+        self.assertEqual(relpath, "cached/test.d45dc1068bc8.js")
+        with storage.staticfiles_storage.open(relpath) as relfile:
+            self.assertIn(
+                b"""JS_URL("import.2b1d40b0bbd4.css")""",
+                relfile.read()
+            )
+
+
 # we set DEBUG to False here since the template tag wouldn't work otherwise
 @override_settings(**dict(TEST_SETTINGS,
     STATICFILES_STORAGE='staticfiles_tests.storage.SimpleCachedStaticFilesStorage',
