קל לארגן דפים בעזרת אוספים אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
מהו Closure Compiler?
Closure Compiler הוא כלי שמאפשר להוריד ולהריץ JavaScript מהר יותר. במקום לבצע קומפילציה משפת מקור לקוד מכונה, הוא מבצע קומפילציה מ-JavaScript ל-JavaScript משופר. הוא מנתח את ה-JavaScript, מסיר קוד לא פעיל, משכתב את מה שנשאר ומצמצם אותו. הוא גם בודק את התחביר, את ההפניות למשתנים ואת הסוגים, ומזהיר מפני בעיות נפוצות ב-JavaScript.
איך משתמשים ב-Closure Compiler?
אפשר להשתמש ב-Closure Compiler בתור:
אפליקציית Java בקוד פתוח שאפשר להריץ משורת הפקודה. ספרייה שאפשר להסתמך עליה דרך Bazel. חבילת NPM כדי להתחיל להשתמש בקומפיילר, אפשר לעיין בקטע 'איך מתחילים' שבהמשך.
מהם היתרונות של השימוש ב-Closure Compiler?
יעילות. הכלי Closure Compiler מקטין את הגודל של קובצי JavaScript והופך אותם ליעילים יותר, כך שהאפליקציה נטענת מהר יותר וצריכת רוחב הפס קטנה יותר.
בדיקת קוד. הכלי Closure Compiler מספק אזהרות לגבי קוד JavaScript לא חוקי ואזהרות לגבי פעולות שעלולות להיות מסוכנות. כך הוא עוזר לכם ליצור קוד JavaScript עם פחות באגים שקל יותר לתחזק.
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-07-26 (שעון UTC).
[null,null,["עדכון אחרון: 2025-07-26 (שעון UTC)."],[[["\u003cp\u003eThe Closure Compiler is a tool that optimizes JavaScript for faster download and execution by analyzing, removing dead code, and minimizing the remaining code.\u003c/p\u003e\n"],["\u003cp\u003eIt offers benefits such as improved efficiency by reducing file size and enhanced code checking by providing warnings for potential issues.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can utilize the Closure Compiler through a command-line application, a simple web interface, or by integrating it into their development workflow via the provided resources and documentation.\u003c/p\u003e\n"]]],[],null,["What is the Closure Compiler?\n\n\nThe Closure Compiler is a tool for making JavaScript download and run\nfaster. Instead of compiling\nfrom a source language to machine code, it compiles from JavaScript to\nbetter JavaScript. It parses your JavaScript, analyzes it, removes\ndead code and rewrites and minimizes what's left. It also checks\nsyntax, variable references, and types, and warns about common\nJavaScript pitfalls.\n\nHow can I use the Closure Compiler?\n\n\nYou can use the Closure Compiler as:\n- An open source Java application that you can run from the command line.\n- A library you can depend on via Bazel.\n- An NPM package\n- To get started with the compiler, see \"How do I start\" below.\n\nWhat are the benefits of using Closure Compiler?\n - **Efficiency.** The Closure Compiler reduces the size of\n your JavaScript files and makes them more efficient, helping your\n application to load faster and reducing your bandwidth needs.\n\n - **Code checking.** The Closure Compiler provides warnings\n for illegal JavaScript and warnings for potentially dangerous\n operations, helping you to produce JavaScript that is less buggy and\n easier to maintain.\n\n How do I start?\n\n\n - Download the most recently released JAR file from the [Maven repository](https://mvnrepository.com/artifact/com.google.javascript/closure-compiler).\n - Work through the [Application\n Hello World](/closure/compiler/docs/gettingstarted_app).\n - Read about [Advanced\n compilation](/closure/compiler/docs/api-tutorial3).\n - Explore [the project's source code](https://github.com/google/closure-compiler).\n\n \u003cbr /\u003e"]]